You are here

function features_get_component_map in Features 6

Same name and namespace in other branches
  1. 7.2 features.module \features_get_component_map()
  2. 7 features.module \features_get_component_map()

Provide a component to feature map.

2 calls to features_get_component_map()
features_get_conflicts in ./features.module
Detect potential conflicts between any features that provide identical components.
features_get_default in ./features.export.inc
Get defaults for a given module/component pair.

File

./features.module, line 595
Module file for the features module, which enables the capture and management of features in Drupal. A feature is a collection of Drupal entities which taken together statisfy a certain use-case.

Code

function features_get_component_map($key = NULL, $reset = FALSE) {
  static $map;
  if (!isset($map) || $reset) {
    $map = array();
    $features = features_get_features(NULL, $reset);
    foreach ($features as $feature) {
      foreach ($feature->info['features'] as $type => $components) {
        if (!isset($map[$type])) {
          $map[$type] = array();
        }
        foreach ($components as $component) {
          $map[$type][$component][] = $feature->name;
        }
      }
    }
  }
  if (isset($key)) {
    return isset($map[$key]) ? $map[$key] : array();
  }
  return $map;
}