You are here

class ConfigNormalizerActive in Configuration Normalizer 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/ConfigNormalizer/ConfigNormalizerActive.php \Drupal\config_normalizer\Plugin\ConfigNormalizer\ConfigNormalizerActive

Normalizes configuration potentially saved to the active storage.

Plugin annotation


@ConfigNormalizer(
  id = "active",
  label = @Translation("Active"),
  weight = 0,
  description = @Translation("Copies over properties that are set by core when configuration is saved to the active storage."),
)

Hierarchy

Expanded class hierarchy of ConfigNormalizerActive

File

src/Plugin/ConfigNormalizer/ConfigNormalizerActive.php, line 18

Namespace

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

  /**
   * {@inheritdoc}
   */
  public function normalize($name, array &$data, array $context) {
    if ($this
      ->isActiveStorageContext($context) && ($active_data = $context['reference_storage_service']
      ->read($name))) {

      // system.site.uuid may be set but empty.
      if (isset($data['uuid']) && empty($data['uuid'])) {
        unset($data['uuid']);
      }

      // Merge in uuid and _core while retaining the key order.
      $merged = array_replace($active_data, $data);
      $data = array_intersect_key($merged, array_flip(array_merge(array_keys($data), [
        'uuid',
        '_core',
      ])));
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigNormalizerActive::normalize public function Normalizes config for comparison. Overrides ConfigNormalizerInterface::normalize
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
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 3
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.