You are here

function themekey_abstract_load_rules in ThemeKey 7.3

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

Parameters

$table:

$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

3 calls to themekey_abstract_load_rules()
themekey_css_load_rules in themekey_css/themekey_css_build.inc
Loads all ThemeKey Rules from the database. Therefore, it uses recursion to build the rule chains.
themekey_load_rules in ./themekey_build.inc
Loads all ThemeKey Rules from the database. Therefore, it uses recursion to build the rule chains.
themekey_redirect_load_rules in themekey_redirect/themekey_redirect_build.inc
Loads all ThemeKey Rules from the database. Therefore, it uses recursion to build the rule chains.

File

./themekey_build.inc, line 301
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_abstract_load_rules($table, $parent = 0, $depth = 0) {
  $properties = array();
  $result = db_select($table, '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_abstract_load_rules($table, $item->id, $depth + 1);
  }
  return $properties;
}