You are here

protected static function Utility::collectOverrides in Search API 8

Collects overrides from a config object.

Parameters

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

array $values: The array of values for the given $prefix.

array $overrides: (optional) The overrides collected so far. Internal use only.

string $prefix: (optional) The config key prefix for the current call level. Internal use only.

Return value

array An associative array mapping property names to their overridden values.

1 call to Utility::collectOverrides()
Utility::getConfigOverrides in src/Utility/Utility.php
Retrieves all overridden property values for the given config entity.

File

src/Utility/Utility.php, line 196

Class

Utility
Contains utility methods for the Search API.

Namespace

Drupal\search_api\Utility

Code

protected static function collectOverrides(Config $config, array $values, array $overrides = [], $prefix = '') {
  foreach ($values as $key => $value) {
    $key = "{$prefix}{$key}";
    if (!$config
      ->hasOverrides($key)) {
      continue;
    }
    if (is_array($value)) {
      NestedArray::setValue($overrides, explode('.', $key), []);
      $overrides = static::collectOverrides($config, $value, $overrides, "{$key}.");
    }
    else {
      NestedArray::setValue($overrides, explode('.', $key), $value);
    }
  }
  return $overrides;
}