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.

Parameters
Property Description
$key
string

Unique key for the data store.

Returns
void

public clearUserPreferences () : void

Clears all user preferences for this controller/widget.

Returns
void

public getUserPreference (string $key = null, mixed $default = null) : mixed

Retrieves a widget related key/value pair from the user preferences

Parameters
Property Description
$key
string

Unique key for the data store.

$default
mixed

A default value to use when value is not found.

Returns
mixed

public getUserPreferences () : array

Retrieves and caches all user preferences for this particular controller/widget.

Returns
array

public putUserPreference (string $key, mixed $value) : void

Saves a widget related key/value pair in to the users preferences

Parameters
Property Description
$key
string

Unique key for the data store.

$value
mixed

The value to store.

Returns
void

protected getPreferenceKey () : string

Returns a unique identifier for this widget and controller action for preference storage.

Returns
string

protected getPreferenceStorage () : Winter\Storm\Database\Model

Specifies the model used for storing the user preferences.

Returns

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.

Copyright © 2024 Winter CMS