You are here

function themekey_load_rules in ThemeKey 7.2

Same name and namespace in other branches
  1. 6.4 themekey_build.inc \themekey_load_rules()
  2. 6.2 themekey_build.inc \themekey_load_rules()
  3. 6.3 themekey_build.inc \themekey_load_rules()
  4. 7.3 themekey_build.inc \themekey_load_rules()
  5. 7 themekey_build.inc \themekey_load_rules()

Loads all ThemeKey Rules from the database. Therefore, it uses recursion to build the rule chains.

Parameters

$parent: id of the parent rule. Default is '0'. During the recursion this parameter changes.

$depth: Integer that represents the 'indentation' in current rule chain. Default is '0'. During the recursion this parameter changes.

Return value

sorted array containing all ThemeKey rules

5 calls to themekey_load_rules()
ThemekeyMultipleNodePropertiesTestCase::testMultipleProperties in tests/ThemekeyMultipleNodePropertiesTestCase.test
themekey_features_graceful_rule_deletion in ./themekey_features.module
Deletes all rules related to this feature, except that the administrator added childs
themekey_features_rule_chain_features_disable_feature in ./themekey_features.module
Implements hook_features_disable_feature().
themekey_rule_chain_form in ./themekey_admin.inc
Form builder for the rule chain.
themekey_rule_disable in ./themekey_build.inc
Disables a ThemeKey rule and all children.

File

./themekey_build.inc, line 286
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_load_rules($parent = 0, $depth = 0) {
  $properties = array();
  $result = db_select('themekey_properties', 'tp')
    ->fields('tp')
    ->condition('parent', $parent)
    ->orderBy('weight', 'asc')
    ->execute();
  foreach ($result as $item) {
    if ('drupal:path' == $item->property) {
      themekey_complete_path($item);
    }
    $item->depth = $depth;
    $properties[$item->id] = get_object_vars($item);
    $properties = $properties + themekey_load_rules($item->id, $depth + 1);
  }
  return $properties;
}