You are here

function themekey_features_load_rule_childs in ThemeKey 6.3

Same name and namespace in other branches
  1. 6.4 themekey_features.module \themekey_features_load_rule_childs()
  2. 7.3 themekey_features.module \themekey_features_load_rule_childs()
  3. 7 themekey_features.module \themekey_features_load_rule_childs()
  4. 7.2 themekey_features.module \themekey_features_load_rule_childs()

Loads current ThemeKey Rule Chain as array.

Parameters

$parent: internal use in recursion

Return value

serialized ThemeKey Rule Chain as array

2 calls to themekey_features_load_rule_childs()
themekey_features_rule_chain_features_export_options in ./themekey_features.module
Implementation of hook_features_export_options().
themekey_features_rule_chain_features_export_render in ./themekey_features.module
Implementation of hook_features_export_render().

File

./themekey_features.module, line 111

Code

function themekey_features_load_rule_childs($parent = 0) {
  module_load_include('inc', 'themekey', 'themekey_base');
  module_load_include('inc', 'themekey', 'themekey_build');
  $rules = array();
  if ($result = db_query("SELECT id FROM {themekey_properties} WHERE parent = %d ORDER BY weight", $parent)) {
    while ($item = db_fetch_array($result)) {

      // we have to load the rule again using themekey_rule_get() which applies some transformations
      $rule = themekey_rule_get($item['id']);
      if ('drupal:path' != $rule['property']) {
        themekey_complete_path($rule);
      }
      unset($rule['id']);
      unset($rule['parent']);
      unset($rule['weight']);
      $rules[] = array(
        'rule' => $rule,
        'string' => themekey_format_rule_as_string($item['id']),
        'childs' => themekey_features_load_rule_childs($item['id']),
      );
    }
  }
  return $rules;
}