function _features_get_used in Features 7.2
Gets a list of component items already provided by (other) enabled modules.
This list can be used to prevent adding/exporting component items to a feature which are already exported elsewhere.
Parameters
string|null $module_name: Module to omit in the returned list.
Return value
string[][][] Format: $[$module][$component][] = $name E.g. $['myfeature']['node'][] = 'article' Object names that are already exported in (other) enabled feature modules.
1 call to _features_get_used()
- _features_export_build in ./
features.admin.inc - Return the full feature export array based upon user selections in form_state.
File
- ./
features.admin.inc, line 1875 - Forms for Features admin screens.
Code
function _features_get_used($module_name = NULL) {
global $features_ignore_conflicts;
// Make sure we turn off the ignore_conflicts global to get full list of used components
// hate to use global, but since this is just for an admin screen it's not a real problem.
// @todo Rethink this in #3077012.
$old_value = $features_ignore_conflicts;
$features_ignore_conflicts = FALSE;
$conflicts = array();
$component_info = features_get_components();
$map = features_get_component_map();
foreach ($map as $type => $components) {
// Only check conflicts for components we know about.
if (isset($component_info[$type])) {
foreach ($components as $component => $modules) {
foreach ($modules as $module) {
// Only for enabled modules.
if (module_exists($module) && (empty($module_name) || $module_name != $module)) {
if (!isset($conflicts[$module])) {
$conflicts[$module] = array();
}
$conflicts[$module][$type][] = $component;
}
}
}
}
}
// Restore previous value of global.
$features_ignore_conflicts = $old_value;
return $conflicts;
}