October CMS resources and help articles

Simple and to the point. Optimized by the community.

Extending Backend Settings to add fields (such as maintenance mode, Customize-backend page)

by mohsin, last modified on March 16th, 2021

If you want to extend a Settings of another plugin or backend section to add fields i.e. the ones that don't have an exclusive controller but rather are just a settings page, you need to extend the form widget associated with it. Now at first if you look at System\Controllers\Settings, the class responsible for rendering settings it may feel like a good idea to extend that and called extendFormFields from your Plugin boot but it wouldn't work since the Settings controller is a special controller that doesn't implement form behavior but directly loads a formwidget internally. So to extend it, you have to hook into it's Form's extension methods.

As an example, let us extend the Maintainence Mode page from another plugin. In the Plugin.php boot method, include:

        Event::listen('backend.form.extendFields', function ($widget) {

            if (!$widget->getController() instanceof \System\Controllers\Settings) {

            // Only for the MaintenanceSetting model
            if (!$widget->model instanceof \Cms\Models\MaintenanceSetting) {

                'disable_feature' => [
                    'label'   => 'Disable Feature?',
                    'type'    => 'switch'



We use cookies to measure the performance of this website. Do you want to accept these cookies?