function themekey_rule_chain_form_submit in ThemeKey 7
Same name and namespace in other branches
- 6.4 themekey_admin.inc \themekey_rule_chain_form_submit()
- 6.2 themekey_admin.inc \themekey_rule_chain_form_submit()
- 6.3 themekey_admin.inc \themekey_rule_chain_form_submit()
- 7.3 themekey_admin.inc \themekey_rule_chain_form_submit()
- 7.2 themekey_admin.inc \themekey_rule_chain_form_submit()
Form submission handler for themekey_rule_chain_form().
See also
File
- ./
themekey_admin.inc, line 420
Code
function themekey_rule_chain_form_submit($form, &$form_state) {
$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']);
themekey_rule_set($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']);
themekey_rule_set($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);
}