You are here

function themekey_rule_disable in ThemeKey 7.2

Same name and namespace in other branches
  1. 7.3 themekey_build.inc \themekey_rule_disable()

Disables a ThemeKey rule and all children.

Parameters

$id: id of the rule to be ddisabled

2 calls to themekey_rule_disable()
themekey_features_rule_chain_features_disable_feature in ./themekey_features.module
Implements hook_features_disable_feature().
themekey_features_save_rule_childs in ./themekey_features.module
Takes a serialized ThemeKey Rule Chain as created by themekey_features_load_rule_childs() and adds it to the current one in the database with it. Conflicting rules will be stored as well, but disabled.

File

./themekey_build.inc, line 445
The functions in this file are the back end of ThemeKey which should be used only if you configure something, but not when ThemeKey switches themes.

Code

function themekey_rule_disable($id) {

  // TRANSACTIONS - SEE http://drupal.org/node/355875
  // The transaction opens here.
  $txn = db_transaction();
  $childs = themekey_load_rules($id);
  $ids = array_merge(array(
    $id,
  ), array_keys($childs));
  foreach ($ids as $id) {
    db_update('themekey_properties')
      ->fields(array(
      'enabled' => 0,
    ))
      ->condition('id', $id)
      ->execute();
  }
}