function _ctools_features_get_info in Features 7
Same name and namespace in other branches
- 6 includes/features.ctools.inc \_ctools_features_get_info()
- 7.2 includes/features.ctools.inc \_ctools_features_get_info()
Helper function to return various ctools information for components.
5 calls to _ctools_features_get_info()
- ctools_component_features_api in includes/
features.ctools.inc - Master implementation of hook_features_api() for all ctools components.
- ctools_component_features_export in includes/
features.ctools.inc - Master implementation of hook_features_export() for all ctools components.
- ctools_features_declare_functions in includes/
features.ctools.inc - ctools_features_export in includes/
features.ctools.inc - Implements hook_features_export(). Adds references to the ctools mothership hook, ctools_plugin_api().
- ctools_features_export_render in includes/
features.ctools.inc - Implements hook_features_export_render(). Adds the ctools mothership hook, ctools_plugin_api().
1 string reference to '_ctools_features_get_info'
- ctools_features_declare_functions in includes/
features.ctools.inc
File
- includes/
features.ctools.inc, line 231
Code
function _ctools_features_get_info($identifier = NULL, $reset = FALSE) {
static $components;
if (!isset($components) || $reset) {
$components = array();
$modules = features_get_info();
ctools_include('export');
drupal_static('ctools_export_get_schemas', NULL, $reset);
foreach (ctools_export_get_schemas_by_module() as $module => $schemas) {
foreach ($schemas as $table => $schema) {
if ($schema['export']['bulk export']) {
// Let the API owner take precedence as the owning module.
$api_module = isset($schema['export']['api']['owner']) ? $schema['export']['api']['owner'] : $module;
$components[$table] = array(
'name' => isset($modules[$api_module]->info['name']) ? $modules[$api_module]->info['name'] : $api_module,
'default_hook' => $schema['export']['default hook'],
'default_file' => FEATURES_DEFAULTS_CUSTOM,
'module' => $api_module,
'feature_source' => TRUE,
);
if (isset($schema['export']['api'])) {
$components[$table] += array(
'api' => $schema['export']['api']['api'],
'default_filename' => $schema['export']['api']['api'],
'current_version' => $schema['export']['api']['current_version'],
);
}
}
}
}
}
// Return information specific to a particular component.
if (isset($identifier)) {
// Identified by the table name.
if (isset($components[$identifier])) {
return $components[$identifier];
}
else {
if (substr_count($identifier, ':') === 2) {
list($module, $api, $current_version) = explode(':', $identifier);
// If a schema component matches the provided identifier, provide that
// information. This also ensures that the version number is up to date.
foreach ($components as $table => $info) {
if ($info['module'] == $module && $info['api'] == $api && $info['current_version'] >= $current_version) {
return $info;
}
}
// Fallback to just giving back what was provided to us.
return array(
'module' => $module,
'api' => $api,
'current_version' => $current_version,
);
}
}
return FALSE;
}
return $components;
}