PHP Класс Habari\ControlStorage

Наследование: implements habari\FormStorage
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$loader Callable | string A function that loads this control value
$saver Callable | string A fucntion that saves this control value

Открытые методы

Метод Описание
__construct ( Callable | string $load, $save ) Construct a basic FormStorage object
field_load ( string $key ) : mixed Loads form values from an object
field_save ( string $key, mixed $value ) Stores a form value into the object
from_object_parameter ( Object $obj, string $parameter ) : ControlStorage Create a new ControlStorage instance to save/load a control value from the parameter of a particular object
from_storage_string ( string $value ) : ControlStorage Produce a basic FormStorage implementation from a classic storage string

Описание методов

__construct() публичный Метод

Construct a basic FormStorage object
public __construct ( Callable | string $load, $save )
$load Callable | string A function to call to load the control value, OR a non-callable
$save

field_load() публичный Метод

Loads form values from an object
public field_load ( string $key ) : mixed
$key string The name of a form component that will be loaded
Результат mixed The stored value returned

field_save() публичный Метод

Stores a form value into the object
public field_save ( string $key, mixed $value )
$key string The name of a form component that will be stored
$value mixed The value of the form component to store

from_object_parameter() публичный Метод

Create a new ControlStorage instance to save/load a control value from the parameter of a particular object
public from_object_parameter ( Object $obj, string $parameter ) : ControlStorage
$obj Object The object that will be saved to or loaded from
$parameter string The name of a parameter on the object that will be used for storage
Результат ControlStorage An instance of a ControlStorage object that will load/save to the specified location

from_storage_string() публичный статический Метод

Produce a basic FormStorage implementation from a classic storage string
public static from_storage_string ( string $value ) : ControlStorage
$value string A classic storage string, such as "option:someoption" or "user:age"
Результат ControlStorage An instance of an object that will save and load to the indicated location

Описание свойств

$loader защищенное свойство

A function that loads this control value
protected Callable|string $loader
Результат Callable | string

$saver защищенное свойство

A fucntion that saves this control value
protected Callable|string $saver
Результат Callable | string