hook_settings
Definition
hook_settings()
developer/hooks/core.php, line 887
Description
Declare administrative settings for a module.
This hook provides an administrative interface for controlling various settings for this module. A menu item for the module under "administration >> settings" will appear in the administrative menu when this hook is implemented.
The form items defined on the settings page will be saved with variable_set(), and can be later retrieved with variable_get(). If you need to store more complicated data (for example, in a separate table), define your own administration page and link to it using hook_menu().
Return value
An HTML string containing form items to place on the module settings page.
Related topics
| Name | Description |
|---|---|
| Hooks | Allow modules to interact with the Drupal core. |
Code
<?php
function hook_settings() {
$output = form_textfield(t('Setting A'), 'example_a',
variable_get('example_a', 'Default setting'), 20, 255,
t('A description of this setting.'));
$output .= form_checkbox(t('Setting B'), 'example_b', 1,
variable_get('example_b', 0), t('A description of this setting.'));
return $output;
}
?> 