You are here

public function ConfigNormalizerSort::normalize in Configuration Normalizer 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/ConfigNormalizer/ConfigNormalizerSort.php \Drupal\config_normalizer\Plugin\ConfigNormalizer\ConfigNormalizerSort::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: An array of key-value pairs to pass additional context when needed.

Overrides ConfigNormalizerInterface::normalize

File

src/Plugin/ConfigNormalizer/ConfigNormalizerSort.php, line 27

Class

ConfigNormalizerSort
Recursively sorts a configuration array.

Namespace

Drupal\config_normalizer\Plugin\ConfigNormalizer

Code

public function normalize($name, array &$data, array $context) {

  // Only sort if the normalization mode is default.
  if ($this
    ->isDefaultModeContext($context)) {

    // Recursively normalize and return.
    $data = $this
      ->normalizeArray($data);
  }
}