‪TYPO3CMS  ‪main
TYPO3\CMS\Backend\Module\ModuleData Class Reference

Public Member Functions

 __construct (string $moduleIdentifier, array $data, array $defaultData=[])
 getModuleIdentifier ()
 get (string $propertyName, mixed $default=null)
 has (string $propertyName)
 set (string $propertyName, mixed $value)
bool clean (string $propertyName, array $allowedValues)
 cleanUp (array $allowedData, bool $useKeys=true)
 toArray ()

Static Public Member Functions

static createFromModule (ModuleInterface $module, array $data)

Protected Attributes

array $properties = []
string $moduleIdentifier
array $defaultData = []

Detailed Description

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).

See also

Definition at line 29 of file ModuleData.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Module\ModuleData::__construct ( string  $moduleIdentifier,
array  $data,
array  $defaultData = [] 

Member Function Documentation

◆ clean()

bool TYPO3\CMS\Backend\Module\ModuleData::clean ( string  $propertyName,
array  $allowedValues 

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.

‪bool True if something has been cleaned up

Definition at line 78 of file ModuleData.php.

References TYPO3\CMS\Backend\Module\ModuleData\has().

Referenced by TYPO3\CMS\Backend\Module\ModuleData\cleanUp().

◆ cleanUp()

TYPO3\CMS\Backend\Module\ModuleData::cleanUp ( array  $allowedData,
bool  $useKeys = true 

Cleans up all module data, which are defined in the given allowed data list. Usually called with $MOD_MENU.

Definition at line 108 of file ModuleData.php.

References TYPO3\CMS\Backend\Module\ModuleData\clean(), and TYPO3\CMS\Backend\Module\ModuleData\has().

◆ createFromModule()

◆ get()

◆ getModuleIdentifier()

◆ has()

TYPO3\CMS\Backend\Module\ModuleData::has ( string  $propertyName)

◆ set()

◆ toArray()

Member Data Documentation

◆ $defaultData

array TYPO3\CMS\Backend\Module\ModuleData::$defaultData = []

Definition at line 33 of file ModuleData.php.

Referenced by TYPO3\CMS\Backend\Module\ModuleData\__construct().

◆ $moduleIdentifier

string TYPO3\CMS\Backend\Module\ModuleData::$moduleIdentifier

◆ $properties

array TYPO3\CMS\Backend\Module\ModuleData::$properties = []

Definition at line 31 of file ModuleData.php.

Referenced by TYPO3\CMS\Backend\Module\ModuleData\toArray().