ConfigNormalizerBase.php in Configuration Normalizer 8
File
src/Plugin/ConfigNormalizerBase.php
View source
<?php
namespace Drupal\config_normalizer\Plugin;
use Drupal\config_normalizer\Config\NormalizedReadOnlyStorageInterface;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class ConfigNormalizerBase extends PluginBase implements ConfigNormalizerInterface {
protected $entityTypeManager;
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityTypeManager = $entity_type_manager;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('entity_type.manager'));
}
protected function isDefaultModeContext(array $context) {
return !empty($context['normalization_mode']) && $context['normalization_mode'] === NormalizedReadOnlyStorageInterface::DEFAULT_NORMALIZATION_MODE;
}
protected function isActiveStorageContext(array $context) {
if (!empty($context['reference_storage_service']) && !empty($context['reference_storage_service']->_serviceId) && $context['reference_storage_service']->_serviceId === 'config.storage') {
return TRUE;
}
return FALSE;
}
}