diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/field/EntityOperations.php b/core/modules/views/lib/Drupal/views/Plugin/views/field/EntityOperations.php index 23d4eae..d38b3f9 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/field/EntityOperations.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/EntityOperations.php @@ -8,8 +8,6 @@ namespace Drupal\views\Plugin\views\field; use Drupal\Core\Entity\EntityListControllerInterface; -use Drupal\Core\Entity\EntityStorageControllerInterface; -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\views\ResultRow; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -25,7 +23,7 @@ * * @PluginID("views_entity_operations") */ -class EntityOperations extends FieldPluginBase implements ContainerFactoryPluginInterface { +class EntityOperations extends FieldPluginBase { /** * The entity list. @@ -35,28 +33,18 @@ class EntityOperations extends FieldPluginBase implements ContainerFactoryPlugin protected $entityList; /** - * The entity storage. - * - * @var \Drupal\Core\Entity\EntityStorageControllerInterface - */ - protected $entityStorage; - - /** * Constructor. * * @param array $configuration * @param string $plugin_id * @param array $plugin_definition - * @param \Drupal\Core\Entity\EntityStorageControllerInterface $entity_storage - * The storage controller of the entity type. * @param \Drupal\Core\Entity\EntityListControllerInterface $entity_list * The list controller of the entity type. */ - public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityStorageControllerInterface $entity_storage, EntityListControllerInterface $entity_list) { + public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityListControllerInterface $entity_list) { parent::__construct($configuration, $plugin_id, $plugin_definition); + $this->entityList = $entity_list; - $this->entityStorage = $entity_storage; - $this->realField = $plugin_definition['id_field']; } /** @@ -65,7 +53,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { /** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */ $entity_manager = $container->get('entity.manager'); - return new static($configuration, $plugin_id, $plugin_definition, $entity_manager->getStorageController($plugin_definition['entity_type']), $entity_manager->getListController($plugin_definition['entity_type'])); + return new static($configuration, $plugin_id, $plugin_definition, $entity_manager->getListController($plugin_definition['entity_type'])); } /** @@ -94,6 +82,7 @@ public function defineOptions() { */ public function buildOptionsForm(&$form, &$form_state) { parent::buildOptionsForm($form, $form_state); + $form['destination'] = array( '#type' => 'checkbox', '#title' => t('Include destination'), @@ -106,15 +95,9 @@ public function buildOptionsForm(&$form, &$form_state) { * {@inheritdoc} */ public function render(ResultRow $values) { - $id = $this->getValue($values); - $entity = $this->entityStorage->load($id); - - $build = array( - '#type' => 'operations', - '#links' => $this->entityList->getOperations($entity), - ); - - return $build; + if ($entity = $this->getEntity($values)) { + return $this->entityList->buildOperations($entity); + } } }