1 config.module config_get_prefix_groups($type = 'active')

Get a list of all configuration prefixes and groups.

This list provided by hook_config_info().

File

core/modules/config/config.module, line 152
Allows site administrators to modify configuration.

Code

function config_get_prefix_groups($type = 'active') {
  $config_info_all = config_get_info();
  $groups = array();
  $ungrouped = t('Ungrouped');

  $config_storage = config_get_config_storage($type);
  foreach ($config_info_all as $prefix => $config_info) {
    $group = isset($config_info['group']) ? $config_info['group'] : $ungrouped;
    if (isset($config_info['label_callback']) || isset($config_info['label_key'])) {
      $config_list = $config_storage->listAll($prefix);
      foreach ($config_list as $config_name) {
        $config = $config_storage->read($config_name);
        if (isset($config_info['label_callback'])) {
          $label = $config_info['label_callback']($config, $config_name);
        }
        elseif (isset($config_info['label_key']) && isset($config[$config_info['label_key']])) {
          $label = $config[$config_info['label_key']];
        }
        else {
          $label = $config_name;
        }
        $groups[$group][$config_name] = $label;
      }
    }
    elseif (isset($config_info['label'])) {
      $groups[$group][$prefix] = $config_info['label'];
    }
  }
  return $groups;
}