Settings and Configuration
By means of a
humhub\components\SettingsManager you can easily store module level key/value settings optionally bound
ContentContainer (e.g. users or spaces).
The SettingsManager component is automatically added all to humhub\components\Module classes.
Note: In order to categorize your key names, use this syntax:
Get desired module:
Create or update existing setting in settings manager:
Load setting with given default value:
Save a serialized setting:
ContentContainer related settings
If you want to store settings related to an user or space - use the
ContentContainerSettingsManager as follows:
Shortcuts for currently logged in user settings:
Shortcuts for current space settings: Note: This is only available if current controller is instance of ContentContainerController.
Sometimes you'll want to use a global setting as default. The following call will try to load a container specific setting,
and will fall back to a global setting with the same key. If no container specific nor a global setting was found the
value will be returned.