You are here

protected function FormOverrides::getConfigKeys in Configuration Override Warn 8

Get all possible keys from a config object.

Parameters

array $values: The root values from the config object.

array $definition: The config definition for $values.

string $prefix: Used for recursion of sub-keys.

Return value

array An array of config keys.

1 call to FormOverrides::getConfigKeys()
FormOverrides::getConfigOverrideDiffs in src/FormOverrides.php
Get overrides for a config.

File

src/FormOverrides.php, line 182

Class

FormOverrides
Contains logic for inspecting config forms and their overridden values.

Namespace

Drupal\config_override_warn

Code

protected function getConfigKeys(array $values, array $definition, $prefix = NULL) {
  $keys = [];
  foreach ($values as $key => $value) {
    if (is_array($value) && isset($definition['mapping'])) {
      $value_definition = NestedArray::getValue($definition['mapping'], explode('.', $key));
      if (isset($value_definition['type']) && $value_definition['type'] === 'mapping') {
        $keys = array_merge($keys, $this
          ->getConfigKeys($value, $value_definition, $prefix . $key . '.'));
        continue;
      }
    }
    $keys[] = $prefix . $key;
  }
  return $keys;
}