protected function ConfigDevelCommands::getExtensionConfig in Configuration development 8
Returns the config for the given extension.
Parameters
string $type: Either 'module', 'theme' or 'profile'.
string $extension: The name of the extension for which to return the config.
Return value
array An array containing install and optional config.
2 calls to ConfigDevelCommands::getExtensionConfig()
- ConfigDevelCommands::export in src/
Commands/ ConfigDevelCommands.php - Write back configuration to module's config directory.
- ConfigDevelCommands::import in src/
Commands/ ConfigDevelCommands.php - Import configuration from module's config directory to active storage.
File
- src/
Commands/ ConfigDevelCommands.php, line 289
Class
- ConfigDevelCommands
- Drush integration for the Configuration Development module.
Namespace
Drupal\config_devel\CommandsCode
protected function getExtensionConfig($type, $extension) {
$filename = drupal_get_path($type, $extension) . '/' . $extension . '.info.yml';
$info = $this->infoParser
->parse($filename);
$config = [];
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'];
}
foreach ([
'install',
'optional',
] as $type) {
if (isset($info['config_devel'][$type])) {
$config[$type] = $info['config_devel'][$type];
}
}
}
return $config;
}