You are here

class ConfigNormalizerFilterFormat 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

Normalizes filter_format config entity data.

Plugin annotation


@ConfigNormalizer(
  id = "filter_format",
  label = @Translation("Filter format"),
  weight = 20,
  description = @Translation("Removes the roles element from filter formats, since this element is valid only on exported configuration."),
)

Hierarchy

Expanded class hierarchy of ConfigNormalizerFilterFormat

Deprecated

in config_normalizer:2.0.0-alpha1 and is removed from config_normalizer:2.0.0. No replacement.

See also

https://www.drupal.org/project/config_normalizer/issues/3230398

File

src/Plugin/ConfigNormalizer/ConfigNormalizerFilterFormat.php, line 21

Namespace

Drupal\config_normalizer\Plugin\ConfigNormalizer
View source
class ConfigNormalizerFilterFormat extends ConfigNormalizerBase implements ContainerFactoryPluginInterface {

  /**
   * {@inheritdoc}
   */
  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']);
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigNormalizerBase::$entityTypeManager protected property The entity type manager.
ConfigNormalizerBase::create public static function
ConfigNormalizerBase::isActiveStorageContext protected function Determines whether the context reference storage is the active storage.
ConfigNormalizerBase::isDefaultModeContext protected function Determines whether the context has a default normalization mode.
ConfigNormalizerBase::__construct public function Creates a new config normalizer plugin. Overrides PluginBase::__construct
ConfigNormalizerFilterFormat::normalize public function Normalizes config for comparison. Overrides ConfigNormalizerInterface::normalize
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 2
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.