You are here

protected function crumbs_Container_WildcardData::buildPrefixedData in Crumbs, the Breadcrumbs suite 7.2

Helper: Actually build the prefixed container.

Parameters

string $prefix: Prefix, as above.

Return value

crumbs_Container_WildcardData The prefixed container.

1 call to crumbs_Container_WildcardData::buildPrefixedData()
crumbs_Container_WeightMap::localWeightMap in lib/Container/WeightMap.php
Gets a local weight map with a prefix. E.g. if the config contains a weight setting "crumbs.nodeParent.* = 5", then in a local weight map with prefix "crumbs", this will be available as "nodeParent.* = 5".

File

lib/Container/WildcardData.php, line 108

Class

crumbs_Container_WildcardData

Code

protected function buildPrefixedData($prefix) {
  $data = array();
  $k = strlen($prefix);
  $data[''] = $data['*'] = $this
    ->wildcardValue($prefix);
  if (isset($this->data[$prefix])) {
    $data[''] = $this->data[$prefix];
  }
  if (isset($this->data[$prefix . '.*'])) {
    $data['*'] = $this->data[$prefix . '.*'];
  }
  foreach ($this->data as $key => $value) {
    if (strlen($key) > $k && substr($key, 0, $k + 1) === $prefix . '.') {
      $data[substr($key, $k + 1)] = $value;
    }
  }
  return $data;
}