Backend\Behaviors\UserPreferencesModel
Overview
UserPreferencesModel 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::class]; public $settingsCode = 'author.plugin::code'; public $settingsFields = 'fields.yaml';
Extends
- System\Behaviors\SettingsModel
- System\Classes\ModelBehavior
- October\Rain\Database\ModelBehavior
- October\Rain\Extension\ExtensionBase
See Also
Public Properties
There are no public properties in the class.
Show inherited public properties
Inherited Public Properties
- $extendableStaticCalledClass - is the calling class when using a static method. (defined in October\Rain\Extension\ExtensionBase)
Protected Properties
There are no protected properties in the class.
Show inherited protected properties
Inherited Protected Properties
- $recordCode - (defined in System\Behaviors\SettingsModel)
- $fieldConfig - (defined in System\Behaviors\SettingsModel)
- $fieldValues - (defined in System\Behaviors\SettingsModel)
- $requiredProperties - (defined in System\Behaviors\SettingsModel)
- $model - Reference to the extended model. (defined in October\Rain\Database\ModelBehavior)
- $extensionHidden - are properties and methods that cannot be accessed. (defined in October\Rain\Extension\ExtensionBase)
- $configPath - specifies a path to the config directory. (defined in System\Behaviors\SettingsModel)
Public Methods
public __construct()
public __construct($model): void
Constructor
public beforeModelSave()
public beforeModelSave(): void
Before the model is saved, ensure the record code is set and the jsonable field values
public getSettingsRecord()
public getSettingsRecord(): Model
Returns the raw Model record that stores the settings.
public instance()
public instance(): void
Create an instance of the settings model, intended as a static method
public isConfigured()
public isConfigured(): void
Checks if the model has been set up previously, intended as a static method
Inherited Public Methods
- afterModelFetch() - populates the field values from the database record. (defined in System\Behaviors\SettingsModel)
- afterModelSave() - clear the cached query entry. (defined in System\Behaviors\SettingsModel)
- clearInternalCache() - of model instances. (defined in System\Behaviors\SettingsModel)
- extend() - this class with a closure. (defined in October\Rain\Extension\ExtensionBase)
- extensionApplyInitCallbacks() - (defined in October\Rain\Extension\ExtensionBase)
- extensionExtendCallback() - is a helper method for
::extend()static method. (defined in October\Rain\Extension\ExtensionBase) - extensionIsHiddenMethod() - (defined in October\Rain\Extension\ExtensionBase)
- extensionIsHiddenProperty() - (defined in October\Rain\Extension\ExtensionBase)
- get() - helper for getSettingsValue, intended as a static method. (defined in System\Behaviors\SettingsModel)
- getCalledExtensionClass() - (defined in October\Rain\Extension\ExtensionBase)
- getConfigPath() - locates a file based on it's definition. If the file starts with. (defined in System\Behaviors\SettingsModel)
- getFieldConfig() - returns the field configuration used by this model. (defined in System\Behaviors\SettingsModel)
- getSettingsValue() - gets a single setting value, or return a default value. (defined in System\Behaviors\SettingsModel)
- guessConfigPath() - guesses the package path for the called class. (defined in System\Behaviors\SettingsModel)
- guessConfigPathFrom() - guesses the package path from a specified class. (defined in System\Behaviors\SettingsModel)
- initSettingsData() - default values to set for this model, override. (defined in System\Behaviors\SettingsModel)
- makeConfig() - reads the contents of the supplied file and applies it to this object. (defined in System\Behaviors\SettingsModel)
- makeConfigFromArray() - makes a config object from an array, making the first. (defined in System\Behaviors\SettingsModel)
- mergeConfig() - merges two configuration sources, either prepared or not, and returns. (defined in System\Behaviors\SettingsModel)
- resetDefault() - this will delete the record model. (defined in System\Behaviors\SettingsModel)
- saveModelInternal() - method for the model. (defined in System\Behaviors\SettingsModel)
- set() - a single or array key pair of values, intended as a static method. (defined in System\Behaviors\SettingsModel)
- setSettingsValue() - sets a single setting value, if allowed. (defined in System\Behaviors\SettingsModel)
Protected Methods
protected getCacheKey()
protected getCacheKey(): void
Returns a cache key for this record.
protected isKeyAllowed()
protected isKeyAllowed($key): void
Checks if a key is legitimate or should be added to the field value collection
Show inherited protected methods
Inherited Protected Methods
- extensionHideMethod() - (defined in October\Rain\Extension\ExtensionBase)
- extensionHideProperty() - (defined in October\Rain\Extension\ExtensionBase)
- getConfigValueFrom() - will apply the config getter convention. (defined in System\Behaviors\SettingsModel)