You are here

public function ConfigItemNormalizer::normalize in Configuration Normalizer 8

Same name and namespace in other branches
  1. 2.0.x src/ConfigItemNormalizer.php \Drupal\config_normalizer\ConfigItemNormalizer::normalize()

Normalizes config for comparison.

Normalization can help ensure that config from different storages can be compared meaningfully.

Parameters

string $name: The name of a configuration object to normalize.

array $data: Configuration array to normalize.

array $context: (optional) An array of key-value pairs to pass additional context when needed.

Return value

array Normalized configuration array.

Overrides ConfigItemNormalizerInterface::normalize

File

src/ConfigItemNormalizer.php, line 39

Class

ConfigItemNormalizer
Class responsible for performing configuration normalization.

Namespace

Drupal\config_normalizer

Code

public function normalize($name, array $data, array $context = []) {
  $normalizers = $this->normalizerManager
    ->getDefinitions();
  uasort($normalizers, [
    'Drupal\\Component\\Utility\\SortArray',
    'sortByWeightElement',
  ]);
  foreach (array_keys($normalizers) as $id) {
    $this
      ->applyNormalizer($id, $name, $data, $context);
  }
  return $data;
}