You are here

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

Same name and namespace in other branches
  1. 8 src/Plugin/ConfigNormalizer/ConfigNormalizerFilterFormat.php \Drupal\config_normalizer\Plugin\ConfigNormalizer\ConfigNormalizerFilterFormat::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/ConfigNormalizerFilterFormat.php, line 26

Class

ConfigNormalizerFilterFormat
Normalizes filter_format config entity data.

Namespace

Drupal\config_normalizer\Plugin\ConfigNormalizer

Code

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

  // In 'prepare' context we don't change data that's needed at write time.
  if ($this
    ->isDefaultModeContext($context) && ($filter_format = $this->entityTypeManager
    ->getDefinition('filter_format', FALSE))) {
    $prefix = $filter_format
      ->getConfigPrefix();

    // The "roles" element from filter formats is valid only on exported
    // configuration.
    if (strpos($name, $prefix . '.') === 0) {
      unset($data['roles']);
    }
  }
}