Source: ~/modules/backend/behaviors/UserPreferencesModel.php


User Preferences model extension, identical to System\Behaviors\SettingsModel except values are set against the logged in user's preferences via Backend\Models\UserPreference

Add this the model class definition:

public $implement = ['Backend.Behaviors.UserPreferencesModel'];
public $settingsCode = 'author.plugin::code';
public $settingsFields = 'fields.yaml';

Public properties

There are no public properties in the class.

Show inherited public properties

Inherited public properties

Protected properties

There are no protected properties in the class.

Show inherited protected properties

Inherited protected properties

Public methods

public void __construct($model)


  • $model

public void beforeModelSave()

Before the model is saved, ensure the record code is set and the jsonable field values

public Model getSettingsRecord()

Returns the raw Model record that stores the settings.

public void instance()

Create an instance of the settings model, intended as a static method

public void isConfigured()

Checks if the model has been set up previously, intended as a static method

Show inherited public methods

Inherited public methods

Protected methods

protected void getCacheKey()

Returns a cache key for this record.

protected void isKeyAllowed($key)

Checks if a key is legitimate or should be added to the field value collection

  • $key

Show inherited protected methods

Inherited protected methods