Same name and namespace in other branches
  1. 4.7.x developer/hooks/core.php \hook_settings()

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.

Return value

An HTML string containing form items to place on the module settings page.

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

Related topics

17 functions implement hook_settings()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

aggregator_settings in modules/aggregator.module
blogapi_settings in modules/blogapi.module
comment_matrix_settings in modules/comment.module
Menu callback; presents the moderation vote matrix.
comment_role_settings in modules/comment.module
Menu callback; allows admin to set default scores for different roles.
comment_save_settings in modules/comment.module

... See full list

File

developer/hooks/core.php, line 887
These are the hooks that are invoked by the Drupal core.

Code

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;
}