function features_get_component_map in Features 7.2
Same name and namespace in other branches
- 6 features.module \features_get_component_map()
- 7 features.module \features_get_component_map()
Provide a component to feature map.
Parameters
string|null $key: (optional) Component type to filter by.
bool $reset: (optional) If TRUE, relevant caches are reset.
Return value
string[][][]|string[][] Format:
- If $key is NULL: $[$component][$name][] = $module
- If $key is not NULL: $[$name][] = $module
4 calls to features_get_component_map()
- features_get_conflicts in ./
features.module - Detects potential conflicts between features that provide the same items.
- features_get_default in ./
features.export.inc - Get defaults for a given module/component pair.
- _drush_features_component_filter in ./
features.drush.inc - Filters components by patterns.
- _features_get_used in ./
features.admin.inc - Gets a list of component items already provided by (other) enabled modules.
File
- ./
features.module, line 1036 - Main *.module file for the 'features' module.
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;
}