You are here

protected function crumbs_PluginSystem_PluginInfo::get_availableKeysMetaGrouped in Crumbs, the Breadcrumbs suite 7.2

Return value

crumbs_Container_MultiWildcardDataOffset[][] Format: $['inherit'][$key] = $meta

See also

crumbs_PluginSystem_PluginInfo::$availableKeysMetaGrouped

File

lib/PluginSystem/PluginInfo.php, line 276

Class

crumbs_PluginSystem_PluginInfo
Info about available plugins and their weights.

Code

protected function get_availableKeysMetaGrouped() {
  $sectionKeys = array();
  foreach ($this->availableKeysMeta as $key => $meta) {
    $sectionKeys[$key] = 'inherit';
  }
  foreach ($this->defaultWeights as $key => $weight) {
    if (!isset($sectionKeys[$key])) {
      continue;
    }
    elseif (FALSE === $weight) {
      $sectionKeys[$key] = 'default:disabled';
    }
    else {
      $sectionKeys[$key] = "default:{$weight}";
    }
  }
  $weights = $this->weights;
  asort($weights);
  $enabled = array();
  foreach ($weights as $key => $weight) {
    if (!isset($sectionKeys[$key])) {
      continue;
    }
    elseif (FALSE === $weight) {
      $sectionKeys[$key] = 'disabled';
    }
    elseif (isset($sectionKeys[$key])) {
      $sectionKeys[$key] = 'enabled';
      $enabled[$key] = TRUE;
    }
  }
  $grouped = array(
    'enabled' => $enabled,
    'disabled' => array(),
    'default:disabled' => array(),
    'inherit' => array(),
  );
  foreach ($this->availableKeysMeta as $key => $meta) {
    $sectionKey = $sectionKeys[$key];
    $grouped[$sectionKey][$key] = $meta;
  }
}