October CMS – Add Menu Item And Store Backend Settings

October CMS Logo

At some point you probably want to make your custom plugin for October CMS configurable and allow backend users to make changes within the plugin space. October CMS has a simple and intuitive backend navigation, which you can easily extend in no-time. Let’s assume you have a custom plugin that calls an external API. Here is how you can store API credentials by using the Settings Manager.

First of all, you must register the settings in your Plugin.php file.

After that you must create a Settings.php file with the following content inside your models folder.

If you define default values inside the method initSettingsData, make sure the above fields match with the definitions inside the fields.yaml file.

Once the fields.yaml file is created, you should see a new form within the new tab.october_cms_playground_sandbox_backend_system_item

Now you can access the settings values within your controller, console or component by implementing the following model.

For test purposes, I created a new controller and implemented the above model to get access to the API key.

Here you go.

october_cms_playground_sandbox_frontend_output

The entire source code can be found on https://github.com/tobias-forkel/october-cms-playground.