You are here

protected function KeyConfigOverrides::getMapping in Key 8

Get a mapping of key configuration overrides.

Return value

array A mapping of key configuration overrides.

1 call to KeyConfigOverrides::getMapping()
KeyConfigOverrides::loadOverrides in src/KeyConfigOverrides.php
Returns config overrides.

File

src/KeyConfigOverrides.php, line 138

Class

KeyConfigOverrides
Provides key overrides for configuration.

Namespace

Drupal\key

Code

protected function getMapping() {
  if (!$this->mapping) {
    $mapping = [];
    $override_ids = $this->configFactory
      ->listAll('key.config_override.');
    $overrides = $this->configFactory
      ->loadMultiple($override_ids);
    foreach ($overrides as $id => $override) {
      $override = $override
        ->get();
      $config_id = '';
      if (!empty($override['config_prefix'])) {
        $config_id .= $override['config_prefix'] . '.';
      }
      if (isset($override['config_name'])) {
        $config_id .= $override['config_name'];
      }
      $config_item = $override['config_item'];
      $key_id = $override['key_id'];
      $mapping[$config_id][$config_item] = $key_id;
    }
    $this->mapping = $mapping;
  }
  return $this->mapping;
}