function configuration_get_info in Configuration Management 7
Helper for retrieving info from system table.
3 calls to configuration_get_info()
- configuration_get_configurations in ./
configuration.module - Wrapper around configuration_get_info() that returns an array of module info objects that are configuration.
- configuration_get_modules in ./
configuration.module - Return a module 'object' including .info information.
- _ctools_configuration_get_info in includes/
configuration.ctools.inc - Helper function to return various ctools information for components.
File
- ./
configuration.module, line 419 - Module file for the configuration module, which enables the capture and management of configuration in Drupal.
Code
function configuration_get_info($type = 'module', $name = NULL, $reset = FALSE) {
static $cache;
if (!isset($cache)) {
$cache = cache_get('configuration_module_info');
}
if (empty($cache) || $reset) {
$data = array();
$ignored = variable_get('configuration_ignored_orphans', array());
$files = system_rebuild_module_data();
foreach ($files as $row) {
// If module is no longer enabled, remove it from the ignored orphans list.
if (in_array($row->name, $ignored, TRUE) && !$row->status) {
$key = array_search($row->name, $ignored, TRUE);
unset($ignored[$key]);
}
if (!empty($row->info['configuration'])) {
// Fix css/js paths
if (!empty($row->info['stylesheets'])) {
foreach ($row->info['stylesheets'] as $media => $css) {
$row->info['stylesheets'][$media] = array_keys($css);
}
}
if (!empty($row->info['scripts'])) {
$row->info['scripts'] = array_keys($row->info['scripts']);
}
$data['configuration'][$row->name] = $row;
}
$data['module'][$row->name] = $row;
}
// Sort configuration according to dependencies.
// @see install_profile_modules()
$required = array();
$non_required = array();
$sorted = array();
foreach ($required + $non_required as $module => $weight) {
$sorted[$module] = $data['configuration'][$module];
}
$data['configuration'] = $sorted;
variable_set('configuration_ignored_orphans', $ignored);
cache_set("configuration_module_info", $data);
$cache = new stdClass();
$cache->data = $data;
}
if (!empty($name)) {
return !empty($cache->data[$type][$name]) ? clone $cache->data[$type][$name] : array();
}
return !empty($cache->data[$type]) ? $cache->data[$type] : array();
}