Using settings in components

Settings in components are usually defined like this:

public function defineProperties()
{
    return [
        'caching' => [
            'title'       => 'enovision.images::lang.settings.resizer.caching',
            'description' => 'enovision.images::lang.settings.resizer.caching_description',
            'default'     => false,
            'type'        => 'checkbox'
        ],
        'caching_days' => [
            'title'       => 'enovision.images::lang.settings.resizer.caching_days',
            'description' => 'enovision.images::lang.settings.resizer.caching_days_description',
            'type'        => 'string',
            'validationPattern' => '^[0-9]+$',
            'validationMessage' => 'enovision.images::lang.settings.number_validation',
            'default'     => '365'
        ],
    ];
}

How to use?

In PHP

Inside the component's PHP you can read the property value with the property method:

$this->property('title');

or:

$this->property('title', 'Fallback title');

or all properties at once:

$this->getProperties();

In Twig

In Twig:

{{ __SELF__.property('title') }}
Last update: October 12th at 9:11am