ModuleData
A simple DTO containing the user specific module settings, e.g. whether the clipboard is shown.
The DTO is created in the PSR-15 middleware BackendModuleValidator, in case a backend module is requested and the user has necessary access permissions. The created DTO is then added as attribute to the PSR-7 Request and can be further used in components, such as middlewares or the route target (usually a backend controller).
Tags
Table of Contents
Properties
- $defaultData : array<string|int, mixed>
- $moduleIdentifier : string
- $properties : array<string|int, mixed>
Methods
- __construct() : mixed
- clean() : bool
- Cleans a single property by the given allowed list. First fallback is the default data list. If this list does also not contain an allowed value, the first value from the allowed list is taken.
- cleanUp() : bool
- Cleans up all module data, which are defined in the given allowed data list. Usually called with $MOD_MENU.
- createFromModule() : self
- get() : mixed
- getModuleIdentifier() : string
- has() : bool
- set() : void
- toArray() : array<string|int, mixed>
Properties
$defaultData
protected
array<string|int, mixed>
$defaultData
= []
$moduleIdentifier
protected
string
$moduleIdentifier
$properties
protected
array<string|int, mixed>
$properties
= []
Methods
__construct()
public
__construct(string $moduleIdentifier, array<string|int, mixed> $data[, array<string|int, mixed> $defaultData = [] ]) : mixed
Parameters
- $moduleIdentifier : string
- $data : array<string|int, mixed>
- $defaultData : array<string|int, mixed> = []
clean()
Cleans a single property by the given allowed list. First fallback is the default data list. If this list does also not contain an allowed value, the first value from the allowed list is taken.
public
clean(string $propertyName, array<string|int, mixed> $allowedValues) : bool
Parameters
- $propertyName : string
- $allowedValues : array<string|int, mixed>
Return values
bool —True if something has been cleaned up
cleanUp()
Cleans up all module data, which are defined in the given allowed data list. Usually called with $MOD_MENU.
public
cleanUp(array<string|int, mixed> $allowedData[, bool $useKeys = true ]) : bool
Parameters
- $allowedData : array<string|int, mixed>
- $useKeys : bool = true
Return values
boolcreateFromModule()
public
static createFromModule(ModuleInterface $module, array<string|int, mixed> $data) : self
Parameters
- $module : ModuleInterface
- $data : array<string|int, mixed>
Return values
selfget()
public
get(string $propertyName[, mixed $default = null ]) : mixed
Parameters
- $propertyName : string
- $default : mixed = null
getModuleIdentifier()
public
getModuleIdentifier() : string
Return values
stringhas()
public
has(string $propertyName) : bool
Parameters
- $propertyName : string
Return values
boolset()
public
set(string $propertyName, mixed $value) : void
Parameters
- $propertyName : string
- $value : mixed
toArray()
public
toArray() : array<string|int, mixed>