Module specific configuration (config.yml)
Each module comes with a config.yml which contains all module specific configuration settings.
The configuration supports the following types:
- config --> Configuration variables
- pages --> Module pages with corresponding parameters
- dependencies --> Dependencies to other modules
- policies --> List of policy flags used by the module
- cron --> List of supported CRONs
- daemon --> List of supported DAEMONs
- provided_hooks --> List of provided hooks
Config Values
Adding configuration parameters to your module is quite easy
- Add a parameter line to the config block of your config.yml
- Get config value within your module by calling
$this->get_config('my_var');
The config system supports multiple field types which are automatically shown in the instance
administration interface and can therefore be easily edited by the system admin. If you want to hide a
certain field from editing just add editable: false to your config parameter.
The config systems currently supports the following field types:
- enum (Select ONE value out of multiple values, UI: Dropdown)
- range (Select a value between a min and max value, UI: Slider)
- array (Enter multiple values, UI: Multitext)
- text (Long Text field, UI: Textarea)
- set (Select MULTIPLE values out of multiple values, UI: Checkbox)
- bool (On or Off, UI: Toggle switch)
- password(Hidden Password Input, UI: Password Input)
- value (Short Text field, UI: Input)
- hook (Hook Trigger --> See hooks)
Dependencies
Each module can hold a dependency to:
- other modules / helpers
- PEAR Packages
- PECL Modules
- other Linux Shell Tools
Using other modules in your own module is a two step process:
- Specify the dependency details in your config YAML and configure the dependent modules in the backend admin
- Get the specified object by using the get_dep() function
dependencies:
modules:
comments: {module: comments, dedicated: true, required: false}
if ($comments = $this->mod->get_dep('comments'))
{
$comments->set_group(42);
//...
}
Required helpers
Required helpers are installed automatically during the module update. If your module requires a certain helper, you can add those to the dependencies:
dependencies:
helper:
- legal
- job_queue