function hook_form_BASE_FORM_ID_alter

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 system.api.php hook_form_BASE_FORM_ID_alter(&$form, &$form_state, $form_id)
cle7 system.api.php hook_form_BASE_FORM_ID_alter(&$form, &$form_state, $form_id)
elmsmedia7 system.api.php hook_form_BASE_FORM_ID_alter(&$form, &$form_state, $form_id)
icor7 system.api.php hook_form_BASE_FORM_ID_alter(&$form, &$form_state, $form_id)
meedjum_blog7 system.api.php hook_form_BASE_FORM_ID_alter(&$form, &$form_state, $form_id)
mooc7 system.api.php hook_form_BASE_FORM_ID_alter(&$form, &$form_state, $form_id)

Provide a form-specific alteration for shared ('base') forms.

By default, when drupal_get_form() is called, Drupal looks for a function with the same name as the form ID, and uses that function to build the form. In contrast, base forms allow multiple form IDs to be mapped to a single base (also called 'factory') form function.

Modules can implement hook_form_BASE_FORM_ID_alter() to modify a specific base form, rather than implementing hook_form_alter() and checking for conditions that would identify the shared form constructor.

To identify the base form ID for a particular form (or to determine whether one exists) check the $form_state. The base form ID is stored under $form_state['build_info']['base_form_id'].

See hook_forms() for more information on how to implement base forms in Drupal.

Form alter hooks are called in the following order: hook_form_alter(), hook_form_BASE_FORM_ID_alter(), hook_form_FORM_ID_alter(). See hook_form_alter() for more details.

Parameters

$form: Nested array of form elements that comprise the form.

$form_state: A keyed array containing the current state of the form.

$form_id: String representing the name of the form itself. Typically this is the name of the function that generated the form.

See also

hook_form_alter()

hook_form_FORM_ID_alter()

drupal_prepare_form()

hook_forms()

Related topics

159 functions implement hook_form_BASE_FORM_ID_alter()

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

accessibility_content_form_field_ui_field_edit_form_alter in sites/all/modules/ulmus/accessibility/modules/accessibility_content/accessibility_content.module
Implements hook_form_FORM_ID_alter().
accessibility_reporting_form_field_ui_field_edit_form_alter in sites/all/modules/ulmus/accessibility/modules/accessibility_reporting/accessibility_reporting.module
Implements hook_form_FORM_ID_alter().
adaptivetheme_form_node_form_alter in sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc
hook_form_BASE_FORM_ID_alter() Modify field classes on node forms.
adaptivetheme_form_search_form_alter in sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc
hook_form_FORM_ID_alter() Modify the Advanced Search Form
adaptivetheme_form_system_theme_settings_alter in sites/all/themes/ulmus/adaptivetheme/at_core/theme-settings.php
@file Implimentation of hook_form_system_theme_settings_alter()

... See full list

File

modules/system/system.api.php, line 1757
Hooks provided by Drupal core and the System module.

Code

function hook_form_BASE_FORM_ID_alter(&$form, &$form_state, $form_id) {
  // Modification for the form with the given BASE_FORM_ID goes here. For
  // example, if BASE_FORM_ID is "node_form", this code would run on every
  // node form, regardless of node type.

  // Add a checkbox to the node form about agreeing to terms of use.
  $form['terms_of_use'] = array(
    '#type' => 'checkbox',
    '#title' => t("I agree with the website's terms and conditions."),
    '#required' => TRUE,
  );
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.