You are here

function drush_config_devel_get_config in Configuration development 8

Gets the config.

Parameters

string $type: module, theme or profile

string $extension: extension name

Return value

array An array containing install and optional config

2 calls to drush_config_devel_get_config()
drush_config_devel_export in drush/config_devel.drush.inc
Drush command callback.
drush_config_devel_import in drush/config_devel.drush.inc
Drush command callback.

File

drush/config_devel.drush.inc, line 212
Configuration development module drush integration.

Code

function drush_config_devel_get_config($type, $extension) {
  $filename = drupal_get_path($type, $extension) . '/' . $extension . '.info.yml';
  $info = \Drupal::service('info_parser')
    ->parse($filename);
  $config = array();
  if (isset($info['config_devel'])) {

    // Keep backwards compatibility for the old format. This has config names
    // listed directly beneath 'config_devel', rather than an intermediate level
    // for 'install' and 'optional'.
    // Detect the old format based on whether there's neither of these two keys.
    if (!isset($info['config_devel']['install']) && !isset($info['config_devel']['optional'])) {
      $info['config_devel']['install'] = $info['config_devel'];
    }
    $config['install'] = $info['config_devel']['install'];

    // If we have any optional configuration, fetch that as well.
    if (isset($info['config_devel']['optional'])) {
      $config['optional'] = $info['config_devel']['optional'];
    }
  }
  return $config;
}