Settings
You can add your own settings to the admin panel.
For that, define following in your plugins .json file:
"settings": "plugins/my-plugin/settings.php",Now open plugins/my-plugin/settings.php and paste following, this is just a basic example:
<?php
return [
'name' => 'My Plugin', // name that will be displayed under Settings menu in Admin Panel
'key' => 'my_plugin', // will be used with setting() function, must be unique for every plugin
'settings' =>
[
[
'type' => 'section',
'title' => 'Section Name'
],
'enabled' => [
'name' => 'Enable Something',
'type' => 'boolean',
'desc' => 'Enable something',
'default' => false,
],
'type' => [
'name' => 'ReCaptcha Version',
'type' => 'options',
'options' => ['v2-checkbox' => 'v2-checkbox', 'v2-invisible' => 'v2-invisible', 'v3' => 'v3'],
'desc' => 'Type of ReCaptcha',
'default' => 'v3',
'show_if' => [
'enabled', '=', 'true',
]
],
]
];Now you can access the settings in PHP by using function: setting('key.option'), example: setting('my_plugin.enabled').
Following "type" are allowed:
New Tab (category)
New Header (section)
Note: After category, there is a requirement to add a section, otherwise it will look weird.
boolean (true/false)
number
text (string)
textarea (long text)
options (select)
Last updated