PreferenceMaker
Preference Maker Trait
trait Backend\Traits\PreferenceMaker
Adds methods for modifying user preferences in a controller class, or a class
that contains a $controller
property referencing a controller.
Properties
protected
static
$preferenceCache
:
array
= []
Cache for retrieved user preferences.
Methods
public clearUserPreference (string $key) : void
Clears a single preference key from the user preferences for this controller/widget.
Property | Type | Description |
---|---|---|
$key | string |
string
Unique key for the data store. |
public clearUserPreferences () : void
Clears all user preferences for this controller/widget.
public
getUserPreference (string $key = null
, mixed $default = null
)
: mixed
Retrieves a widget related key/value pair from the user preferences
Property | Type | Description |
---|---|---|
$key | string |
string
Unique key for the data store. |
$default | mixed |
mixed
A default value to use when value is not found. |
public getUserPreferences () : array
Retrieves and caches all user preferences for this particular controller/widget.
public putUserPreference (string $key, mixed $value) : void
Saves a widget related key/value pair in to the users preferences
Property | Type | Description |
---|---|---|
$key | string |
string
Unique key for the data store. |
$value | mixed |
mixed
The value to store. |
protected getPreferenceKey () : string
Returns a unique identifier for this widget and controller action for preference storage.
protected getPreferenceStorage () : Winter\Storm\Database\Model
Used by
Class | Description |
---|---|
Lists
|
List Widget Used for building back end lists, renders a list of model objects |
MediaManager
|
Media Manager widget. |
MediaManager
|
Media Manager widget. |