You are here

public function FormOverrides::getConfigOverrides in Configuration Override Warn 8

Get all overridden values from a config object.

Parameters

\Drupal\Core\Config\Config $config: The config object.

Return value

array A nested array of the overridden values on the config.

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

File

src/FormOverrides.php, line 153

Class

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

Namespace

Drupal\config_override_warn

Code

public function getConfigOverrides(Config $config) {
  $overrides = [];
  if ($config
    ->hasOverrides()) {
    $properties = [
      'moduleOverrides',
      'settingsOverrides',
    ];
    foreach ($properties as $property) {
      $reflection = new \ReflectionProperty($config, $property);
      $reflection
        ->setAccessible(TRUE);
      $property_overrides = $reflection
        ->getValue($config);
      if (isset($property_overrides) && is_array($property_overrides)) {
        $overrides = NestedArray::mergeDeepArray([
          $overrides,
          $property_overrides,
        ], TRUE);
      }
    }
  }
  return $overrides;
}