function google_tag_settings_form_submit in GoogleTagManager 7
Same name and namespace in other branches
- 7.2 includes/form/settings.inc \google_tag_settings_form_submit()
Form submission handler for google_tag_settings_form().
3 string references to 'google_tag_settings_form_submit'
- google_tag_form_variable_edit_form_alter in ./
google_tag.module - Implements hook_form_FORM_ID_alter() for variable_edit_form().
- google_tag_form_variable_realm_edit_variables_form_alter in ./
google_tag.module - Implements hook_form_FORM_ID_alter() for variable_realm_edit_variables_form().
- google_tag_settings_form_after_build in includes/
admin.inc - Element after build callback for google_tag_settings_form().
File
- includes/
admin.inc, line 183 - Contains the administrative page and form callbacks.
Code
function google_tag_settings_form_submit($form, &$form_state) {
if (module_exists('variable_realm') && module_exists('variable_store')) {
// When this handler runs, $GLOBALS['conf'] will have been updated by the
// form submitted values (this includes realm and non-realm specific
// variables). However, the variable stores maintained by variable_realm
// will not reflect these changes. To counteract this behaviour refresh the
// internal variable stores.
//
// Example: Assume a language realm with 'en' (default) and 'fr' keys.
//
// Because of how variable_realm_switch() works, the values for one or more
// realm:key pairs will include the OLD global (i.e. not realm-specific)
// values in effect at form build not the NEW values included with the form
// submission. Whether one or more is stale depends on the realm of the URL:
//
// default: /admin/config/system/google_tag
// realm: /fr/admin/config/system/google_tag
//
// The result does not depend on whether any google_tag variables are
// configured to be realm-specific.
//
// The global:default snippet files always reflect the NEW global values
// plus the realm-specific values for the realm of the URL. If the form is
// submitted from the 'en' (or default) URL, then these files have the 'en'
// values.
//
// The language:en snippet files have OLD global values if the realm URL is
// language:fr (indicated by 'fr' prefix), NEW values otherwise. Any realm-
// specific values are from language:en.
//
// The language:fr snippet files always have OLD global values. Any realm-
// specific values are from language:fr.
// Load variables from cache or database.
// Merge with current global to get values from settings.php.
$variables = variable_initialize();
$variables = array_merge($GLOBALS['conf'], $variables);
// recursive?
// Reset internal store with updated variables.
$global = variable_realm_controller('global');
$global
->addStore('default', $variables);
}
// Set global to avoid message display to non-admin users on cache flush.
global $_google_tag_display_message;
$_google_tag_display_message = TRUE;
_google_tag_assets_create();
}