You are here

function _hansel_build_config in Hansel breadcrumbs 8

Same name and namespace in other branches
  1. 7 hansel.module \_hansel_build_config()

Build the Hansel configuration object.

This object is used to cache the whole Hansel configuration. We use this to generate the breadcrumbs and for the export functionality.

@access private

Return value

array

1 call to _hansel_build_config()
hansel_get_config in ./hansel.module
Get Hansel configuration.

File

./hansel.module, line 394
Hansel module

Code

function _hansel_build_config() {
  $start_rid = NULL;
  $rules = array();
  foreach (_hansel_get_rules(-1) as $name => $rule) {

    // Add children
    $rule->children = array();
    $res = db_query("SELECT r.rid FROM {hansel_rule} r WHERE r.pid = :pid", array(
      ':pid' => $rule->rid,
    ));
    while ($rec = $res
      ->fetchAssoc()) {
      $rule->children[] = $rec['rid'];
    }
    $rules[$rule->rid] = $rule;
    if (empty($rule->pid) && $rule->name == 'start') {
      $start_rid = $rule->rid;
    }
  }
  return array(
    'version' => 1,
    'start_rid' => $start_rid,
    'rules' => $rules,
    'nodetypes' => variable_get('hansel_nodetypes', array()),
  );
}