You are here

protected function KeyConfigOverrideAddForm::getConfigItems in Key 8

Get the configuration items for a specified configuration name.

Parameters

string|null $config_type: The configuration type.

string|null $config_name: The configuration name.

Return value

array The configuration items.

1 call to KeyConfigOverrideAddForm::getConfigItems()
KeyConfigOverrideAddForm::buildForm in src/Form/KeyConfigOverrideAddForm.php
Form constructor.

File

src/Form/KeyConfigOverrideAddForm.php, line 342

Class

KeyConfigOverrideAddForm
KeyConfigOverrideAddForm class.

Namespace

Drupal\key\Form

Code

protected function getConfigItems($config_type = NULL, $config_name = NULL) {
  $config_items = [];
  if (!$config_name) {
    return $config_items;
  }

  // For simple configuration, use the configuration name. For configuration
  // entities, use a combination of the prefix and configuration name.
  if ($config_type == 'system.simple') {
    $name = $config_name;
  }
  else {
    $definition = $this
      ->getConfigEntityTypeDefinitions()[$config_type];
    $name = $definition
      ->getConfigPrefix() . '.' . $config_name;
  }
  $config_object = $this->configFactory
    ->get($name);
  $config_array = $config_object
    ->get();
  $config_items += $this
    ->flattenConfigItemList($config_array);
  $config_items = array_combine($config_items, $config_items);
  return $config_items;
}