You are here

protected function KeyListBuilder::getOverridesByKeyId in Key 8

Get any overrides associated with a key.

Parameters

string $key_id: The ID of the key.

Return value

array The overrides associated with a key.

1 call to KeyListBuilder::getOverridesByKeyId()
KeyListBuilder::buildRow in src/Controller/KeyListBuilder.php
Builds a row for an entity in the entity listing.

File

src/Controller/KeyListBuilder.php, line 136

Class

KeyListBuilder
Provides a listing of keys.

Namespace

Drupal\key\Controller

Code

protected function getOverridesByKeyId($key_id) {
  if (!$this->overrides) {
    $entities = $this->entityTypeManager
      ->getStorage('key_config_override')
      ->loadMultiple();
    foreach ($entities as $entity) {

      // Build the complete configuration ID.
      $config_id = '';
      $config_type = $entity
        ->getConfigType();
      if ($config_type != 'system.simple') {
        $definition = $this->entityTypeManager
          ->getDefinition($config_type);
        $config_id .= $definition
          ->getConfigPrefix() . '.';
      }
      $config_id .= $entity
        ->getConfigName();
      $config_id .= ':' . $entity
        ->getConfigItem();
      $this->overrides[$entity
        ->getKeyId()][] = $config_id;
    }
  }
  return isset($this->overrides[$key_id]) ? $this->overrides[$key_id] : [];
}