You are here

function themekey_abstract_rule_chain_form_submit in ThemeKey 7.3

3 calls to themekey_abstract_rule_chain_form_submit()
themekey_css_rule_chain_form_submit in themekey_css/themekey_css_admin.inc
Form submission handler for themekey_rule_chain_form().
themekey_redirect_rule_chain_form_submit in themekey_redirect/themekey_redirect_admin.inc
Form submission handler for themekey_rule_chain_form().
themekey_rule_chain_form_submit in ./themekey_admin.inc
Form submission handler for themekey_rule_chain_form().

File

./themekey_admin.inc, line 462

Code

function themekey_abstract_rule_chain_form_submit($form, &$form_state, $options) {
  $max_weight = 0;
  if (!empty($form_state['values']['old_items'])) {
    foreach ($form_state['values']['old_items'] as $id => $item) {
      if ($item['weight'] > $max_weight) {
        $max_weight = $item['weight'];
      }
      $item['id'] = $id;
      if ('drupal:path:wildcard' == $item['property']) {
        $item['property'] = $item['wildcard'];
      }
      unset($item['wildcard']);
      $options['rule_set_callback']($item);
    }
  }
  if (!empty($form_state['values']['new_item']['value']) || '0' === $form_state['values']['new_item']['value']) {
    $item = $form_state['values']['new_item'];
    $item['parent'] = 0;
    $item['weight'] = $max_weight + 1;
    if ('drupal:path:wildcard' == $item['property']) {
      $item['property'] = $item['wildcard'];
    }
    unset($item['wildcard']);
    $options['rule_set_callback']($item);
  }
  drupal_set_message(check_plain(t('The configuration options have been saved. Trying to clear page cache ...')));

  // fast deletion of page cache (truncate)
  cache_clear_all('*', 'cache_page', TRUE);
}