Skip to content

Kirby 3.6.6

Options

Registering options

Options are registered with the options extension. The extension accepts an array of options with their default values. The default values will be used if the options are not overwritten in the site config.

Kirby::plugin('yourname/yourplugin', [
    'options' => [
        'option' => 'some-value',
        'another-option' => [
            'with-a-nested-option' => 'and values'
        ]
    ]
]);

Setting custom options in the site config

See the guide.

Accessing option values

Config options can be used anywhere in Kirby with the $kirby->option() method:

$kirby->option('yourname.yourplugin.option');
$kirby->option('yourname.yourplugin.another-option.with-a-nested-option');

Or with the option() helper:

option('yourname.yourplugin.option');
option('yourname.yourplugin.another-option.with-a-nested-option');