function google_tag_form_variable_edit_form_alter in GoogleTagManager 7
Implements hook_form_FORM_ID_alter() for variable_edit_form().
This applies to:
- individual variables with a path like:
admin/config/system/variable/edit/google_tag_role_toggle
- all variables by group with a path like:
admin/config/system/variable/group/google_tag
- all variables by module with a path like:
admin/config/system/variable/module/google_tag
on the latter two forms:
- comment says 'These are global default variables.'
- regardless the highlighted value in realm switcher
- realm name:key = global:default
- $form[#variable_options][realm]->realm and key
all of these forms have:
- element parents are none
- $form[#variable_edit_form] contains list of variables on the form
- with first form need to check the variable being in this module
on all pages:
- variable_realm_key_[realm] may be a query argument in the url
File
- ./
google_tag.module, line 119 - Provides primary Drupal hook implementations.
Code
function google_tag_form_variable_edit_form_alter(&$form, &$form_state, $form_id) {
// Also include these on group and module pages for element validation.
form_load_include($form_state, 'inc', 'google_tag', 'includes/admin');
form_load_include($form_state, 'inc', 'google_tag', 'includes/variable');
if (strpos($_GET['q'], 'admin/config/system/variable/edit/') === 0) {
if (strpos($form['#variable_edit_form'][0], 'google_tag_') === 0) {
$form['#submit'][] = 'google_tag_settings_form_submit';
}
}
}