diff --git a/core/modules/node/src/Plugin/Condition/NodeType.php b/core/modules/node/src/Plugin/Condition/NodeType.php index 2c1b2fd..040026b 100644 --- a/core/modules/node/src/Plugin/Condition/NodeType.php +++ b/core/modules/node/src/Plugin/Condition/NodeType.php @@ -8,7 +8,7 @@ namespace Drupal\node\Plugin\Condition; use Drupal\Core\Condition\ConditionPluginBase; -use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -29,20 +29,20 @@ class NodeType extends ConditionPluginBase implements ContainerFactoryPluginInte /** * The entity manager. - * @var \Drupal\Core\Entity\EntityManagerInterface + * @var \Drupal\Core\Entity\EntityStorageInterface */ - protected $entityManager; + protected $entityStorage; /** * Creates a new NodeType instance. * - * @param \Drupal\Core\Plugin\ContainerFactoryPluginInterface $entity_manager + * @param \Drupal\Core\Entity\EntityStorageInterface $entity_storage * The entity manager. * {@inheritdoc} */ - public function __construct(EntityManagerInterface $entity_manager, array $configuration, $plugin_id, $plugin_definition) { + public function __construct(EntityStorageInterface $entity_storage, array $configuration, $plugin_id, $plugin_definition) { parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->entityManager = $entity_manager; + $this->entityStorage = $entity_storage; } /** @@ -50,7 +50,7 @@ public function __construct(EntityManagerInterface $entity_manager, array $confi */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( - $container->get('entity.manager'), + $container->get('entity.manager')->getStorage('node_type'), $configuration, $plugin_id, $plugin_definition @@ -63,7 +63,7 @@ public static function create(ContainerInterface $container, array $configuratio public function buildConfigurationForm(array $form, array &$form_state) { $form = parent::buildConfigurationForm($form, $form_state); $options = array(); - $node_types = $this->entityManager->getStorage('node_type')->loadMultiple(); + $node_types = $this->entityStorage->loadMultiple(); foreach ($node_types as $type) { $options[$type->type] = $type->name; } @@ -82,7 +82,7 @@ public function buildConfigurationForm(array $form, array &$form_state) { */ public function validateConfigurationForm(array &$form, array &$form_state) { foreach ($form_state['values']['bundles'] as $bundle) { - $node_types = $this->entityManager->getStorage('node_type')->loadMultiple(); + $node_types = $this->entityStorage->loadMultiple(); if (!in_array($bundle, array_keys($node_types))) { form_set_error('bundles', $form_state, t('You have chosen an invalid node bundle, please check your selection and try again.')); }