This project is not covered by Drupal’s security advisory policy.
This module is only provide API for other modules.
Features
This module allows for other modules:
- To specify structure and default values of all module settings in one place by using "hook_get_settings()".
- Use variable naming standards: <module_name> "_" <setting_name>.
- Use defined default values everywhere (with option to override default value).
So, you don't need to specify same default value for every "variable_get()" call.
Also if you will decide to change default value of your setting, all you need is to change it in the "hook_get_settings()" implementation, not on every "variable_get()" call.
Example:
Instead ofvariable_get('my_module_var1', 456)in several places of a code, you can just usesettings_get_for('my_module', 'var1')or evensettings_get('var1')if you get a value of your own module from itself.
To override default value use the same approach as for "variable_get":settings_get_for('my_module', 'var1', 987)orsettings_get('var1', 987)
(This will override default value with "987".) - Automatic check for existence of setting at the moment of "set" or "get" and in case if setting it's not defined raise an error. This will keep your code consistent with your settings.
- Use this module functions without need to manually specify your module name.
- Show default values (collapsible for multi-line values) near options forms elements, if it's value are not equal to default.
- Show default mark (ex: "(default)") (configurable at admin page) near options forms elements, if it's value are equal to default.
- Export & Import modules settings (with batch support).
- Simply delete all module settings at "hook_uninstall()", just calling "settings_delete_all('my_module')". So, you will never forget about to delete some variable.
- Automatically specify default values ('#default_value') for admin settings form by using "settings_prepare_settings_form('my_module', $form)", this will also automatically rename element names from format '<setting_name>' to format '<module_name> "_" <setting_name>' (for proper processing with "system_settings_form_submit()").
- Eliminate need to use "variable" table directly.
This module is compatible with standard "variable_*" functions.
Usage example
BitTorrent module (since 6.x-9.2-alpha4).
Project information
- Project categories: Administration tools, Developer tools
1 site reports using this module
- Created by liquixis on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.