Setting Hooks

Setting Module


The setting module comes with the following hooks. You can hook into those using the usual listener logic.

SettingIsCreating

These methods are available:

  • getSettingName(): will return the setting name
  • getSettingValues(): will return the setting value(s)
  • setSettingValues($settingValues): set the value for the current setting
  • getOriginal(): get the original setting values

SettingIsUpdating

The SettingIsUpdating has one more method:

  • getSetting(): Will return the setting being updated

SettingIsCreating Example

To keep the example simple we're going to use an inline listener using a closure instead of a full class.

Lets say we want to uppercase our core::template setting:

Event::listen(SettingIsCreating::class, function (SettingIsCreating $event) {
    if ($event->getSettingName() === 'core::template') {
        $event->setSettingValues('my-template');
    }
});

Mobile Analytics