You are here

function xmlsitemap_form_submit_flag_regenerate in XML sitemap 6.2

Same name and namespace in other branches
  1. 8 xmlsitemap.module \xmlsitemap_form_submit_flag_regenerate()
  2. 7.2 xmlsitemap.module \xmlsitemap_form_submit_flag_regenerate()
  3. 2.x xmlsitemap.module \xmlsitemap_form_submit_flag_regenerate()

Submit handler; Set the regenerate needed flag if variables have changed.

This function needs to be called before system_settings_form_submit() or any calls to variable_set().

2 string references to 'xmlsitemap_form_submit_flag_regenerate'
xmlsitemap_form_locale_languages_overview_form_alter in xmlsitemap_i18n/xmlsitemap_i18n.module
Implements hook_form_FORM_ID_alter().
xmlsitemap_i18n_form_i18n_admin_settings_alter in xmlsitemap_i18n/xmlsitemap_i18n.module
Implements hook_form_FORM_ID_alter().

File

./xmlsitemap.module, line 1191
Main file for the xmlsitemap module.

Code

function xmlsitemap_form_submit_flag_regenerate($form, $form_state) {
  foreach ($form_state['values'] as $variable => $value) {
    $stored_value = variable_get($variable, 'not_a_variable');
    if (is_array($value) && !empty($form_state['values']['array_filter'])) {
      $value = array_keys(array_filter($value));
    }
    if ($stored_value != 'not_a_variable' && $stored_value != $value) {
      variable_set('xmlsitemap_regenerate_needed', TRUE);
      drupal_set_message(t('XML sitemap settings have been modified and the files should be regenerated. You can <a href="@run-cron">run cron manually</a> to regenerate the cached files.', array(
        '@run-cron' => url('admin/reports/status/run-cron', array(
          'query' => drupal_get_destination(),
        )),
      )), 'warning', FALSE);
      return;
    }
  }
}