function metatag_admin_settings_form_submit in Metatag 7
Form API submission callback for metatag_admin_settings_form().
1 string reference to 'metatag_admin_settings_form_submit'
- metatag_admin_settings_form in ./
metatag.admin.inc - Misc settings page.
File
- ./
metatag.admin.inc, line 894 - Administration page callbacks for the metatag module.
Code
function metatag_admin_settings_form_submit($form, &$form_state) {
// Only keep maxlength values that are numeric. Any empty, non-zero values
// will be removed.
foreach ($form_state['values'] as $name => $value) {
if (strpos($name, 'metatag_maxlength_') !== FALSE) {
if (empty($value) && $value !== 0 && $value !== '0' || !is_numeric($value)) {
unset($form_state['values'][$name]);
variable_del($name);
}
else {
$form_state['values'][$name] = intval($value);
}
}
}
// If the token option was disabled, clear the token cache too.
$old_var = (bool) variable_get('metatag_summary_text_field', FALSE);
$new_var = !empty($form_state['values']['metatag_summary_text_field']);
if ($old_var != $new_var) {
token_clear_cache();
}
// Make sure the metatag_summary_length value is a number.
if (!empty($form_state['values']['metatag_summary_length'])) {
$form_state['values']['metatag_summary_length'] = intval($form_state['values']['metatag_summary_length']);
}
// Clear the Metatag caches so any settings changes will be available.
cache_clear_all('*', 'cache_metatag', TRUE);
drupal_set_message(t('The Metatag cache has been cleared so all meta tags can be reloaded.'));
}