function features_include_defaults in Features 7
Same name and namespace in other branches
- 6 features.module \features_include_defaults()
- 7.2 features.module \features_include_defaults()
Load features includes for all components that require includes before collecting defaults.
2 calls to features_include_defaults()
- features_get_default in ./
features.export.inc - Get defaults for a given module/component pair.
- features_get_default_map in ./
features.export.inc - Get a map of components to their providing modules.
File
- ./
features.module, line 354 - 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_include_defaults($components = NULL, $reset = FALSE) {
static $included = array();
static $include_components;
// Build an array of components that require inclusion:
// Views, CTools components and those using FEATURES_DEFAULTS_INCLUDED.
if (!isset($include_components) || $reset) {
$include_components = features_get_components();
foreach ($include_components as $component => $info) {
if (!isset($info['api']) && (!isset($info['default_file']) || $info['default_file'] !== FEATURES_DEFAULTS_INCLUDED)) {
unset($include_components[$component]);
}
}
}
// If components are specified, only include for the specified components.
if (isset($components)) {
$components = is_array($components) ? $components : array(
$components,
);
}
else {
$components = array_keys($include_components);
}
foreach ($components as $component) {
if (isset($include_components[$component]) && (!isset($included[$component]) || $reset)) {
$info = $include_components[$component];
// Inclusion of ctools components.
if (isset($info['api'], $info['module'], $info['current_version'])) {
ctools_include('plugins');
ctools_plugin_api_include($info['module'], $info['api'], $info['current_version'], $info['current_version']);
}
else {
$features = isset($features) ? $features : features_get_features(NULL, $reset);
foreach ($features as $feature) {
$filename = isset($info['default_file']) && $info['default_file'] == FEATURES_DEFAULTS_CUSTOM ? $info['default_filename'] : "features.{$component}";
module_load_include('inc', $feature->name, "{$feature->name}.{$filename}");
}
}
$included[$component] = TRUE;
}
}
}