diff --git a/core/modules/node/src/Plugin/views/row/Rss.php b/core/modules/node/src/Plugin/views/row/Rss.php index b97bb64..b4e535f 100644 --- a/core/modules/node/src/Plugin/views/row/Rss.php +++ b/core/modules/node/src/Plugin/views/row/Rss.php @@ -10,6 +10,7 @@ use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\views\Plugin\views\row\RssPluginBase; +use Drupal\views\ViewExecutableFactory; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\node\NodeStorageInterface; @@ -60,9 +61,11 @@ class Rss extends RssPluginBase { * The plugin implementation definition. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_manager); + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, ViewExecutableFactory $executable_factory) { + parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_manager, $executable_factory); $this->nodeStorage = $entity_manager->getStorage('node'); } diff --git a/core/modules/views/src/EventSubscriber/RouteSubscriber.php b/core/modules/views/src/EventSubscriber/RouteSubscriber.php index abc5bb6..7185614 100644 --- a/core/modules/views/src/EventSubscriber/RouteSubscriber.php +++ b/core/modules/views/src/EventSubscriber/RouteSubscriber.php @@ -15,6 +15,7 @@ use Drupal\views\ViewExecutable; use Drupal\views\Views; use Symfony\Component\Routing\RouteCollection; +use Drupal\views\ViewExecutableFactory; use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; use Symfony\Component\HttpKernel\KernelEvents; @@ -52,6 +53,13 @@ class RouteSubscriber extends RouteSubscriberBase { protected $state; /** + * The factory to load a view executable with. + * + * @var \Drupal\views\ViewExecutableFactory + */ + protected $executableFactory; + + /** * Stores an array of route names keyed by view_id.display_id. * * @var array @@ -65,10 +73,13 @@ class RouteSubscriber extends RouteSubscriberBase { * The entity manager. * @param \Drupal\Core\State\StateInterface $state * The state key value store. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. */ - public function __construct(EntityManagerInterface $entity_manager, StateInterface $state) { + public function __construct(EntityManagerInterface $entity_manager, StateInterface $state , ViewExecutableFactory $executable_factory) { $this->viewStorage = $entity_manager->getStorage('view'); $this->state = $state; + $this->executableFactory = $executable_factory; } /** @@ -121,8 +132,7 @@ public function routes() { foreach ($this->getViewsDisplayIDsWithRoute() as $pair) { list($view_id, $display_id) = explode('.', $pair); $view = $this->viewStorage->load($view_id); - // @todo This should have an executable factory injected. - if (($view = $view->getExecutable()) && $view instanceof ViewExecutable) { + if (($view = $this->executableFactory->get($view)) && $view instanceof ViewExecutable) { if ($view->setDisplay($display_id) && $display = $view->displayHandlers->get($display_id)) { if ($display instanceof DisplayRouterInterface) { $this->viewRouteNames += (array) $display->collectRoutes($collection); @@ -143,8 +153,7 @@ protected function alterRoutes(RouteCollection $collection) { foreach ($this->getViewsDisplayIDsWithRoute() as $pair) { list($view_id, $display_id) = explode('.', $pair); $view = $this->viewStorage->load($view_id); - // @todo This should have an executable factory injected. - if (($view = $view->getExecutable()) && $view instanceof ViewExecutable) { + if (($view = $this->executableFactory->get($view)) && $view instanceof ViewExecutable) { if ($view->setDisplay($display_id) && $display = $view->displayHandlers->get($display_id)) { if ($display instanceof DisplayRouterInterface) { // If the display returns TRUE a route item was found, so it does not diff --git a/core/modules/views/src/Plugin/Derivative/ViewsBlock.php b/core/modules/views/src/Plugin/Derivative/ViewsBlock.php index 3ebfc5f..02502fd 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsBlock.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsBlock.php @@ -10,6 +10,7 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\views\ViewExecutableFactory; /** * Provides block plugin definitions for all Views block displays. @@ -40,12 +41,20 @@ class ViewsBlock implements ContainerDeriverInterface { protected $viewStorage; /** + * The factory to load a view executable with. + * + * @var \Drupal\views\ViewExecutableFactory + */ + protected $executableFactory; + + /** * {@inheritdoc} */ public static function create(ContainerInterface $container, $base_plugin_id) { return new static( $base_plugin_id, - $container->get('entity.manager')->getStorage('view') + $container->get('entity.manager')->getStorage('view'), + $container->get('views.executable') ); } @@ -56,10 +65,13 @@ public static function create(ContainerInterface $container, $base_plugin_id) { * The base plugin ID. * @param \Drupal\Core\Entity\EntityStorageInterface $view_storage * The entity storage to load views. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. */ - public function __construct($base_plugin_id, EntityStorageInterface $view_storage) { + public function __construct($base_plugin_id, EntityStorageInterface $view_storage, ViewExecutableFactory $executable_factory) { $this->basePluginId = $base_plugin_id; $this->viewStorage = $view_storage; + $this->executableFactory = $executable_factory; } /** @@ -83,7 +95,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { if (!$view->status()) { continue; } - $executable = $view->getExecutable(); + $executable = $this->executableFactory->get($view); $executable->initDisplay(); foreach ($executable->displayHandlers as $display) { // Add a block plugin definition for each block display. diff --git a/core/modules/views/src/Plugin/Derivative/ViewsExposedFilterBlock.php b/core/modules/views/src/Plugin/Derivative/ViewsExposedFilterBlock.php index f405aed..4b0a7d1 100644 --- a/core/modules/views/src/Plugin/Derivative/ViewsExposedFilterBlock.php +++ b/core/modules/views/src/Plugin/Derivative/ViewsExposedFilterBlock.php @@ -9,6 +9,7 @@ use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; use Drupal\Core\Entity\EntityStorageInterface; +use Drupal\views\ViewExecutableFactory; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -40,16 +41,26 @@ class ViewsExposedFilterBlock implements ContainerDeriverInterface { protected $basePluginId; /** + * The factory to load a view executable with. + * + * @var \Drupal\views\ViewExecutableFactory + */ + protected $executableFactory; + + /** * Constructs a ViewsExposedFilterBlock object. * * @param string $base_plugin_id * The base plugin ID. * @param \Drupal\Core\Entity\EntityStorageInterface $view_storage * The entity storage to load views. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. */ - public function __construct($base_plugin_id, EntityStorageInterface $view_storage) { + public function __construct($base_plugin_id, EntityStorageInterface $view_storage, ViewExecutableFactory $executable_factory) { $this->basePluginId = $base_plugin_id; $this->viewStorage = $view_storage; + $this->executableFactory = $executable_factory; } /** @@ -58,7 +69,9 @@ public function __construct($base_plugin_id, EntityStorageInterface $view_storag public static function create(ContainerInterface $container, $base_plugin_id) { return new static( $base_plugin_id, - $container->get('entity.manager')->getStorage('view') + $container->get('entity.manager')->getStorage('view'), + $container->get('views.executable') + ); } @@ -83,7 +96,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { if (!$view->status()) { continue; } - $executable = $view->getExecutable(); + $executable = $this->executableFactory->get($view); $executable->initDisplay(); foreach ($executable->displayHandlers as $display) { if (isset($display) && $display->getOption('exposed_block')) { diff --git a/core/modules/views/src/Plugin/ViewsHandlerManager.php b/core/modules/views/src/Plugin/ViewsHandlerManager.php index 5244147..deae4a6 100644 --- a/core/modules/views/src/Plugin/ViewsHandlerManager.php +++ b/core/modules/views/src/Plugin/ViewsHandlerManager.php @@ -11,6 +11,7 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Plugin\DefaultPluginManager; +use Drupal\views\ViewExecutableFactory; use Drupal\views\ViewsData; use Symfony\Component\DependencyInjection\Container; use Drupal\views\Plugin\views\HandlerBase; @@ -37,6 +38,13 @@ class ViewsHandlerManager extends DefaultPluginManager implements FallbackPlugin protected $handlerType; /** + * The factory to load a view executable with. + * + * @var \Drupal\views\ViewExecutableFactory + */ + protected $executableFactory; + + /** * Constructs a ViewsHandlerManager object. * * @param string $handler_type @@ -50,8 +58,10 @@ class ViewsHandlerManager extends DefaultPluginManager implements FallbackPlugin * Cache backend instance to use. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. */ - public function __construct($handler_type, \Traversable $namespaces, ViewsData $views_data, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { + public function __construct($handler_type, \Traversable $namespaces, ViewsData $views_data, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ViewExecutableFactory $executable_factory) { $plugin_definition_annotation_name = 'Drupal\views\Annotation\Views' . Container::camelize($handler_type); $plugin_interface = 'Drupal\views\Plugin\views\ViewsHandlerInterface'; if ($handler_type == 'join') { @@ -67,6 +77,7 @@ public function __construct($handler_type, \Traversable $namespaces, ViewsData $ $this->defaults = array( 'plugin_type' => $handler_type, ); + $this->executableFactory = $executable_factory; } /** @@ -127,6 +138,7 @@ public function createInstance($plugin_id, array $configuration = array()) { if ($instance instanceof HandlerBase) { $instance->setModuleHandler($this->moduleHandler); $instance->setViewsData($this->viewsData); + $instance->setExecutableFactory($this->executableFactory); } return $instance; } diff --git a/core/modules/views/src/Plugin/views/HandlerBase.php b/core/modules/views/src/Plugin/views/HandlerBase.php index b10b948..79ae997 100644 --- a/core/modules/views/src/Plugin/views/HandlerBase.php +++ b/core/modules/views/src/Plugin/views/HandlerBase.php @@ -18,6 +18,7 @@ use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\ViewExecutable; use Drupal\Core\Database\Database; +use Drupal\views\ViewExecutableFactory; use Drupal\views\Views; use Drupal\views\ViewsData; @@ -93,6 +94,13 @@ protected $moduleHandler; /** + * The factory to load a view executable with. + * + * @var \Drupal\views\ViewExecutableFactory + */ + protected $executableFactory; + + /** * The views data service. * * @var \Drupal\views\ViewsData @@ -335,6 +343,29 @@ public function setModuleHandler(ModuleHandlerInterface $module_handler) { } /** + * Gets the executable factory. + * + * @return \Drupal\views\ViewExecutableFactory + */ + protected function getExecutableFactory() { + if (!$this->executableFactory) { + $this->executableFactory = Views::executableFactory(); + } + + return $this->executableFactory; + } + + /** + * Sets the executable factory. + * + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. + */ + public function setExecutableFactory(ViewExecutableFactory $executable_factory) { + $this->executableFactory = $executable_factory; + } + + /** * Provides the handler some groupby. */ public function usesGroupBy() { @@ -773,7 +804,7 @@ public function displayExposedForm($form, FormStateInterface $form_state) { $display_id = $form_state->get('display_id'); $type = $form_state->get('type'); $id = $form_state->get('id'); - $view->getExecutable()->setHandler($display_id, $type, $id, $item); + $this->getExecutableFactory()->get($view)->setHandler($display_id, $type, $id, $item); $view->addFormToStack($form_state->get('form_key'), $display_id, $type, $id, TRUE, TRUE); @@ -802,7 +833,7 @@ public function submitTemporaryForm($form, FormStateInterface $form_state) { $override = NULL; $view = $form_state->get('view'); - $executable = $view->getExecutable(); + $executable = $this->getExecutableFactory()->get($view); if ($executable->display_handler->useGroupBy() && !empty($item['group_type'])) { if (empty($executable->query)) { $executable->initQuery(); @@ -827,7 +858,7 @@ public function submitTemporaryForm($form, FormStateInterface $form_state) { $handler->unpackOptions($handler->options, $options, NULL, FALSE); // Store the item back on the view. - $executable = $view->getExecutable(); + $executable = $this->getExecutableFactory()->get($view); $executable->temporary_options[$type][$form_state->get('id')] = $handler->options; // @todo Decide if \Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm() is diff --git a/core/modules/views/src/Plugin/views/area/View.php b/core/modules/views/src/Plugin/views/area/View.php index 8ef480b..2ec9b6a 100644 --- a/core/modules/views/src/Plugin/views/area/View.php +++ b/core/modules/views/src/Plugin/views/area/View.php @@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\views\ViewExecutableFactory; use Drupal\views\Views; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -35,6 +36,13 @@ class View extends AreaPluginBase { */ protected $viewStorage; + /** + * The factory to load a view executable with. + * + * @var \Drupal\views\ViewExecutableFactory + */ + protected $executableFactory; + /** * Constructs a View object. * @@ -46,24 +54,28 @@ class View extends AreaPluginBase { * The plugin implementation definition. * @param \Drupal\Core\Entity\EntityStorageInterface $view_storage * The view storage. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $view_storage) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $view_storage, ViewExecutableFactory $executable_factory) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->viewStorage = $view_storage; + $this->executableFactory = $executable_factory; } - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity.manager')->getStorage('view') - ); - } + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('entity.manager')->getStorage('view'), + $container->get('views.executable') + ); + } /** * {@inheritdoc} @@ -109,7 +121,7 @@ public function render($empty = FALSE) { if (!empty($this->options['view_to_insert'])) { list($view_name, $display_id) = explode(':', $this->options['view_to_insert']); - $view = $this->viewStorage->load($view_name)->getExecutable(); + $view = $this->executableFactory->get($this->viewStorage->load($view_name)); if (empty($view) || !$view->access($display_id)) { return array(); diff --git a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php index d2e9fe8..6e43a7e 100644 --- a/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php +++ b/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php @@ -83,6 +83,8 @@ */ var $always_required = FALSE; + + /** * Overrides \Drupal\views\Plugin\views\HandlerBase::init(). * @@ -445,7 +447,7 @@ public function buildGroupForm($form, FormStateInterface $form_state) { $display_id = $form_state->get('display_id'); $type = $form_state->get('type'); $id = $form_state->get('id'); - $view->getExecutable()->setHandler($display_id, $type, $id, $item); + $this->getExecutableFactory()->get($view)->setHandler($display_id, $type, $id, $item); $view->addFormToStack($form_state->get('form_key'), $display_id, $type, $id, TRUE, TRUE); @@ -1110,7 +1112,7 @@ public function addGroupForm($form, FormStateInterface $form_state) { $display_id = $form_state->get('display_id'); $type = $form_state->get('type'); $id = $form_state->get('id'); - $view->getExecutable()->setHandler($display_id, $type, $id, $item); + $this->getExecutableFactory()->get($view)->setHandler($display_id, $type, $id, $item); $view->cacheSet(); $form_state->set('rerender', TRUE); diff --git a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php index 6e9bf5d..5c4441a 100644 --- a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php +++ b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php @@ -9,7 +9,9 @@ use Drupal\Core\Database\Query\AlterableInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\views\ViewExecutableFactory; use Drupal\views\Views; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Relationship handler that allows a groupwise maximum of the linked in table. @@ -64,6 +66,42 @@ class GroupwiseMax extends RelationshipPluginBase { /** + * The factory to load a view executable with. + * + * @var \Drupal\views\ViewExecutableFactory + */ + protected $executableFactory; + + /** + * Constructs an GroupwiseMax object. + * + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin_id for the plugin instance. + * @param mixed $plugin_definition + * The plugin implementation definition. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. + */ + public function __construct(array $configuration, $plugin_id, $plugin_definition, ViewExecutableFactory $executable_factory) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + $this->executableFactory = $executable_factory; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('views.executable') + ); + } + + /** * {@inheritdoc} */ protected function defineOptions() { @@ -158,7 +196,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { protected function getTemporaryView() { $view = entity_create('view', array('base_table' => $this->definition['base'])); $view->addDisplay('default'); - return $view->getExecutable(); + return $this->executableFactory->get($view); } /** diff --git a/core/modules/views/src/Plugin/views/row/EntityRow.php b/core/modules/views/src/Plugin/views/row/EntityRow.php index e95e5fa..732707d 100644 --- a/core/modules/views/src/Plugin/views/row/EntityRow.php +++ b/core/modules/views/src/Plugin/views/row/EntityRow.php @@ -14,6 +14,7 @@ use Drupal\views\Entity\Render\EntityTranslationRenderTrait; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\ViewExecutable; +use Drupal\views\ViewExecutableFactory; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -76,9 +77,11 @@ class EntityRow extends RowPluginBase { * The entity manager. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition); + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, LanguageManagerInterface $language_manager, ViewExecutableFactory $executable_factory) { + parent::__construct($configuration, $plugin_id, $plugin_definition, $executable_factory); $this->entityManager = $entity_manager; $this->languageManager = $language_manager; @@ -100,7 +103,14 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('entity.manager'), $container->get('language_manager')); + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('entity.manager'), + $container->get('language_manager'), + $container->get('views.executable') + ); } /** diff --git a/core/modules/views/src/Plugin/views/row/RowPluginBase.php b/core/modules/views/src/Plugin/views/row/RowPluginBase.php index 059a415..b13a96b 100644 --- a/core/modules/views/src/Plugin/views/row/RowPluginBase.php +++ b/core/modules/views/src/Plugin/views/row/RowPluginBase.php @@ -10,7 +10,9 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\views\Plugin\views\PluginBase; use Drupal\views\ViewExecutable; +use Drupal\views\ViewExecutableFactory; use Drupal\views\Views; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * @defgroup views_row_plugins Views row plugins @@ -56,6 +58,42 @@ protected $usesFields = FALSE; /** + * The factory to load a view executable with. + * + * @var \Drupal\views\ViewExecutableFactory + */ + protected $executableFactory; + + /** + * Constructs a PluginBase object. + * + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin_id for the plugin instance. + * @param mixed $plugin_definition + * The plugin implementation definition. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. + */ + public function __construct(array $configuration, $plugin_id, $plugin_definition, ViewExecutableFactory $executable_factory) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + $this->executableFactory = $executable_factory; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('views.executable') + ); + } + + /** * Returns the usesFields property. * * @return bool @@ -82,7 +120,7 @@ protected function defineOptions() { public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); if (isset($this->base_table)) { - $executable = $form_state->get('view')->getExecutable(); + $executable = $this->executableFactory->get($form_state->get('view')); // A whole bunch of code to figure out what relationships are valid for // this item. diff --git a/core/modules/views/src/Plugin/views/row/RssPluginBase.php b/core/modules/views/src/Plugin/views/row/RssPluginBase.php index ed1e5b9..11bbe05 100644 --- a/core/modules/views/src/Plugin/views/row/RssPluginBase.php +++ b/core/modules/views/src/Plugin/views/row/RssPluginBase.php @@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\views\ViewExecutableFactory; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -35,8 +36,8 @@ * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition); + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, ViewExecutableFactory $executable_factory) { + parent::__construct($configuration, $plugin_id, $plugin_definition, $executable_factory); $this->entityManager = $entity_manager; } @@ -49,7 +50,8 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('entity.manager') + $container->get('entity.manager'), + $container->get('views.executable') ); } diff --git a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php index b787285..0606c64 100644 --- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php @@ -11,11 +11,13 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\UrlGeneratorTrait; use Drupal\views\Entity\View; +use Drupal\views\ViewExecutableFactory; use Drupal\views\Views; use Drupal\views_ui\ViewUI; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\Plugin\views\PluginBase; use Drupal\views\Plugin\views\wizard\WizardInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * @defgroup views_wizard_plugins Views wizard plugins @@ -115,12 +117,29 @@ ); /** + * The factory to load a view executable with. + * + * @var \Drupal\views\ViewExecutableFactory + */ + protected $executableFactory; + + /** * Constructs a WizardPluginBase object. + * + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin_id for the plugin instance. + * @param mixed $plugin_definition + * The plugin implementation definition. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, ViewExecutableFactory $executable_factory) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->base_table = $this->definition['base_table']; + $this->executableFactory = $executable_factory; $entity_types = \Drupal::entityManager()->getDefinitions(); foreach ($entity_types as $entity_type_id => $entity_type) { @@ -132,6 +151,18 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition } /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('views.executable') + ); + } + + /** * Gets the createdColumn property. * * @return string @@ -730,7 +761,7 @@ protected function alterDisplayOptions(&$display_options, $form, FormStateInterf protected function addDisplays(View $view, $display_options, $form, FormStateInterface $form_state) { // Initialize and store the view executable to get the display plugin // instances. - $executable = $view->getExecutable(); + $executable = $this->executableFactory->get($view); // Display: Master $default_display = $executable->newDisplay('default', 'Master', 'default'); @@ -1237,7 +1268,7 @@ protected function setValidatedView(array $form, FormStateInterface $form_state, */ public function validateView(array $form, FormStateInterface $form_state) { $view = $this->instantiateView($form, $form_state); - $errors = $view->getExecutable()->validate(); + $errors = $this->executableFactory->get($view)->validate(); if (empty($errors)) { $this->setValidatedView($form, $form_state, $view); diff --git a/core/modules/views/views.services.yml b/core/modules/views/views.services.yml index 1a01543..6ef31b5 100644 --- a/core/modules/views/views.services.yml +++ b/core/modules/views/views.services.yml @@ -4,10 +4,10 @@ services: arguments: [access, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.area: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [area, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] + arguments: [area, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@views.executable'] plugin.manager.views.argument: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [argument, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] + arguments: [argument, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@views.executable'] plugin.manager.views.argument_default: class: Drupal\views\Plugin\ViewsPluginManager arguments: [argument_default, '@container.namespaces', '@cache.discovery', '@module_handler'] @@ -28,13 +28,13 @@ services: arguments: [exposed_form, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.field: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [field, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] + arguments: [field, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@views.executable'] plugin.manager.views.filter: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [filter, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] + arguments: [filter, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@views.executable'] plugin.manager.views.join: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [join, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] + arguments: [join, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@views.executable'] plugin.manager.views.pager: class: Drupal\views\Plugin\ViewsPluginManager arguments: [pager, '@container.namespaces', '@cache.discovery', '@module_handler'] @@ -43,13 +43,13 @@ services: arguments: [query, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.relationship: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [relationship, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] + arguments: [relationship, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@views.executable'] plugin.manager.views.row: class: Drupal\views\Plugin\ViewsPluginManager arguments: [row, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.sort: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [sort, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] + arguments: [sort, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler', '@views.executable'] plugin.manager.views.style: class: Drupal\views\Plugin\ViewsPluginManager arguments: [style, '@container.namespaces', '@cache.discovery', '@module_handler'] @@ -70,7 +70,7 @@ services: arguments: ['@module_handler'] views.route_subscriber: class: Drupal\views\EventSubscriber\RouteSubscriber - arguments: ['@entity.manager', '@state'] + arguments: ['@entity.manager', '@state', '@views.executable'] tags: - { name: 'event_subscriber' } views.exposed_form_cache: diff --git a/core/modules/views_ui/src/Controller/ViewsUIController.php b/core/modules/views_ui/src/Controller/ViewsUIController.php index f03328a..77ddb1f 100644 --- a/core/modules/views_ui/src/Controller/ViewsUIController.php +++ b/core/modules/views_ui/src/Controller/ViewsUIController.php @@ -12,6 +12,7 @@ use Drupal\Core\Url; use Drupal\views\ViewExecutable; use Drupal\views\ViewEntityInterface; +use Drupal\views\ViewExecutableFactory; use Drupal\views\Views; use Drupal\views_ui\ViewUI; use Drupal\views\ViewsData; @@ -34,13 +35,23 @@ class ViewsUIController extends ControllerBase { protected $viewsData; /** + * The factory to load a view executable with. + * + * @var \Drupal\views\ViewExecutableFactory + */ + protected $executableFactory; + + /** * Constructs a new \Drupal\views_ui\Controller\ViewsUIController object. * * @param \Drupal\views\ViewsData views_data * The Views data cache object. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. */ - public function __construct(ViewsData $views_data) { + public function __construct(ViewsData $views_data, ViewExecutableFactory $executable_factory) { $this->viewsData = $views_data; + $this->executableFactory = $executable_factory; } /** @@ -48,7 +59,8 @@ public function __construct(ViewsData $views_data) { */ public static function create(ContainerInterface $container) { return new static( - $container->get('views.views_data') + $container->get('views.views_data'), + $container->get('views.executable') ); } @@ -66,7 +78,7 @@ public function reportFields() { $fields = array(); $handler_types = ViewExecutable::getHandlerTypes(); foreach ($views as $view) { - $executable = $view->getExecutable(); + $executable = $this->executableFactory->get($view); $executable->initDisplay(); foreach ($executable->displayHandlers as $display_id => $display) { if ($executable->setDisplay($display_id)) { diff --git a/core/modules/views_ui/src/ViewEditForm.php b/core/modules/views_ui/src/ViewEditForm.php index 2fc7fc4..4ad0fb0 100644 --- a/core/modules/views_ui/src/ViewEditForm.php +++ b/core/modules/views_ui/src/ViewEditForm.php @@ -21,6 +21,7 @@ use Drupal\Core\Render\ElementInfoManagerInterface; use Drupal\Core\Url; use Drupal\user\SharedTempStoreFactory; +use Drupal\views\ViewExecutableFactory; use Drupal\views\Views; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; @@ -60,6 +61,13 @@ class ViewEditForm extends ViewFormBase { protected $elementInfo; /** + * The factory to load a view executable with. + * + * @var \Drupal\views\ViewExecutableFactory + */ + protected $executableFactory; + + /** * Constructs a new ViewEditForm object. * * @param \Drupal\user\SharedTempStoreFactory $temp_store_factory @@ -70,12 +78,15 @@ class ViewEditForm extends ViewFormBase { * The date Formatter service. * @param \Drupal\Core\Render\ElementInfoManagerInterface $element_info * The element info manager. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. */ - public function __construct(SharedTempStoreFactory $temp_store_factory, RequestStack $requestStack, DateFormatter $date_formatter, ElementInfoManagerInterface $element_info) { + public function __construct(SharedTempStoreFactory $temp_store_factory, RequestStack $requestStack, DateFormatter $date_formatter, ElementInfoManagerInterface $element_info, ViewExecutableFactory $executable_factory) { $this->tempStore = $temp_store_factory->get('views'); $this->requestStack = $requestStack; $this->dateFormatter = $date_formatter; $this->elementInfo = $element_info; + $this->executableFactory = $executable_factory; } /** @@ -86,7 +97,8 @@ public static function create(ContainerInterface $container) { $container->get('user.shared_tempstore'), $container->get('request_stack'), $container->get('date.formatter'), - $container->get('element_info') + $container->get('element_info'), + $container->get('views.executable') ); } @@ -96,6 +108,8 @@ public static function create(ContainerInterface $container) { public function form(array $form, FormStateInterface $form_state) { $view = $this->entity; $display_id = $this->displayID; + $executable = $this->executableFactory->get($view); + $executable->initDisplay(); // Do not allow the form to be cached, because $form_state->get('view') can become // stale between page requests. // See views_ui_ajax_get_form() for how this affects #ajax. @@ -107,7 +121,7 @@ public function form(array $form, FormStateInterface $form_state) { $form_state->disableCache(); if ($display_id) { - if (!$view->getExecutable()->setDisplay($display_id)) { + if (!$this->executableFactory->get($view)->setDisplay($display_id)) { $form['#markup'] = $this->t('Invalid display id @display', array('@display' => $display_id)); return $form; } @@ -193,8 +207,8 @@ public function form(array $form, FormStateInterface $form_state) { ); // Add a text that the display is disabled. - if ($view->getExecutable()->displayHandlers->has($display_id)) { - if (!$view->getExecutable()->displayHandlers->get($display_id)->isEnabled()) { + if ($executable->displayHandlers->has($display_id)) { + if (!$executable->displayHandlers->get($display_id)->isEnabled()) { $form['displays']['settings']['disabled']['#markup'] = $this->t('This display is disabled.'); } } @@ -210,8 +224,7 @@ public function form(array $form, FormStateInterface $form_state) { $tab_content['#attributes']['class'][] = 'views-display-deleted'; } // Mark disabled displays as such. - - if ($view->getExecutable()->displayHandlers->has($display_id) && !$view->getExecutable()->displayHandlers->get($display_id)->isEnabled()) { + if ($executable->displayHandlers->has($display_id) && !$executable->displayHandlers->get($display_id)->isEnabled()) { $tab_content['#attributes']['class'][] = 'views-display-disabled'; } $form['displays']['settings']['settings_content'] = array( @@ -265,7 +278,7 @@ public function validate(array $form, FormStateInterface $form_state) { if ($view->isLocked()) { $form_state->setErrorByName('', $this->t('Changes cannot be made to a locked view.')); } - foreach ($view->getExecutable()->validate() as $display_errors) { + foreach ($this->executableFactory->get($view)->validate() as $display_errors) { foreach ($display_errors as $error) { $form_state->setErrorByName('', $error); } @@ -277,7 +290,7 @@ public function validate(array $form, FormStateInterface $form_state) { */ public function save(array $form, FormStateInterface $form_state) { $view = $this->entity; - $executable = $view->getExecutable(); + $executable = $this->executableFactory->get($view); $executable->initDisplay(); // Go through and remove displayed scheduled for removal. @@ -324,8 +337,8 @@ public function save(array $form, FormStateInterface $form_state) { continue; } - if (($display->getPluginId() == 'page') && ($old_path == $destination) && ($old_path != $view->getExecutable()->displayHandlers->get($id)->getOption('path'))) { - $destination = $view->getExecutable()->displayHandlers->get($id)->getOption('path'); + if (($display->getPluginId() == 'page') && ($old_path == $destination) && ($old_path != $this->executableFactory->get($view)->displayHandlers->get($id)->getOption('path'))) { + $destination = $this->executableFactory->get($view)->displayHandlers->get($id)->getOption('path'); $query->remove('destination'); } } @@ -363,7 +376,9 @@ public function cancel(array $form, FormStateInterface $form_state) { public function getDisplayTab($view) { $build = array(); $display_id = $this->displayID; - $display = $view->getExecutable()->displayHandlers->get($display_id); + $executable = $this->executableFactory->get($view); + $executable->initDisplay(); + $display = $executable->displayHandlers->get($display_id); // If the plugin doesn't exist, display an error message instead of an edit // page. if (empty($display)) { @@ -394,12 +409,14 @@ public function getDisplayDetails($view, $display) { '#theme_wrappers' => array('container'), '#attributes' => array('id' => 'edit-display-settings-details'), ); + $executable = $this->executableFactory->get($view); + $executable->initDisplay(); $is_display_deleted = !empty($display['deleted']); // The master display cannot be duplicated. $is_default = $display['id'] == 'default'; // @todo: Figure out why getOption doesn't work here. - $is_enabled = $view->getExecutable()->displayHandlers->get($display['id'])->isEnabled(); + $is_enabled = $executable->displayHandlers->get($display['id'])->isEnabled(); if ($display['id'] != 'default') { $build['top']['#theme_wrappers'] = array('container'); @@ -428,8 +445,8 @@ public function getDisplayDetails($view, $display) { } // Add a link to view the page unless the view is disabled or has no // path. - elseif ($view->status() && $view->getExecutable()->displayHandlers->get($display['id'])->hasPath()) { - $path = $view->getExecutable()->displayHandlers->get($display['id'])->getPath(); + elseif ($view->status() && $executable->displayHandlers->get($display['id'])->hasPath()) { + $path = $executable->displayHandlers->get($display['id'])->getPath(); if ($path && (strpos($path, '%') === FALSE)) { $build['top']['actions']['path'] = array( '#type' => 'link', @@ -504,7 +521,7 @@ public function getDisplayDetails($view, $display) { $build['top']['display_title'] = array( '#theme' => 'views_ui_display_tab_setting', '#description' => $this->t('Display name'), - '#link' => $view->getExecutable()->displayHandlers->get($display['id'])->optionLink(SafeMarkup::checkPlain($display_title), 'display_title'), + '#link' => $executable->displayHandlers->get($display['id'])->optionLink(SafeMarkup::checkPlain($display_title), 'display_title'), ); } @@ -545,7 +562,7 @@ public function getDisplayDetails($view, $display) { // Fetch options from the display plugin, with a list of buckets they go into. $options = array(); - $view->getExecutable()->displayHandlers->get($display['id'])->optionsSummary($buckets, $options); + $executable->displayHandlers->get($display['id'])->optionsSummary($buckets, $options); // Place each option into its bucket. foreach ($options as $id => $option) { @@ -612,7 +629,7 @@ public function submitDisplayEnable($form, FormStateInterface $form_state) { $view = $this->entity; $id = $form_state->get('display_id'); // setOption doesn't work because this would might affect upper displays - $view->getExecutable()->displayHandlers->get($id)->setOption('enabled', TRUE); + $this->executableFactory->get($view)->displayHandlers->get($id)->setOption('enabled', TRUE); // Store in cache $view->cacheSet(); @@ -630,7 +647,7 @@ public function submitDisplayEnable($form, FormStateInterface $form_state) { public function submitDisplayDisable($form, FormStateInterface $form_state) { $view = $this->entity; $id = $form_state->get('display_id'); - $view->getExecutable()->displayHandlers->get($id)->setOption('enabled', FALSE); + $this->executableFactory->get($view)->displayHandlers->get($id)->setOption('enabled', FALSE); // Store in cache $view->cacheSet(); @@ -672,7 +689,7 @@ public function submitDisplayDelete($form, FormStateInterface $form_state) { */ public function rebuildCurrentTab(ViewUI $view, AjaxResponse $response, $display_id) { $this->displayID = $display_id; - if (!$view->getExecutable()->setDisplay('default')) { + if (!$this->executableFactory->get($view)->setDisplay('default')) { return; } @@ -821,10 +838,11 @@ public function submitDelayDestination($form, FormStateInterface $form_state) { public function submitDisplayDuplicate($form, FormStateInterface $form_state) { $view = $this->entity; $display_id = $this->displayID; + $executable = &$this->executableFactory->get($view); // Create the new display. $displays = $view->get('display'); - $display = $view->getExecutable()->newDisplay($displays[$display_id]['display_plugin']); + $display = $executable->newDisplay($displays[$display_id]['display_plugin']); $new_display_id = $display->display['id']; $displays[$new_display_id] = $displays[$display_id]; $displays[$new_display_id]['id'] = $new_display_id; @@ -832,7 +850,7 @@ public function submitDisplayDuplicate($form, FormStateInterface $form_state) { // By setting the current display the changed marker will appear on the new // display. - $view->getExecutable()->current_display = $new_display_id; + $executable->current_display = $new_display_id; $view->cacheSet(); // Redirect to the new display's edit page. @@ -847,14 +865,15 @@ public function submitDisplayDuplicate($form, FormStateInterface $form_state) { */ public function submitDisplayAdd($form, FormStateInterface $form_state) { $view = $this->entity; + $executable = &$this->executableFactory->get($view); // Create the new display. $parents = $form_state->getTriggeringElement()['#parents']; $display_type = array_pop($parents); - $display = $view->getExecutable()->newDisplay($display_type); + $display = $executable->newDisplay($display_type); $display_id = $display->display['id']; // A new display got added so the asterisks symbol should appear on the new // display. - $view->getExecutable()->current_display = $display_id; + $executable->current_display = $display_id; $view->cacheSet(); // Redirect to the new display's edit page. @@ -880,7 +899,7 @@ public function submitDuplicateDisplayAsType($form, FormStateInterface $form_sta // By setting the current display the changed marker will appear on the new // display. - $view->getExecutable()->current_display = $new_display_id; + $this->executableFactory->get($view)->current_display = $new_display_id; $view->cacheSet(); // Redirect to the new display's edit page. @@ -897,28 +916,31 @@ public function submitDuplicateDisplayAsType($form, FormStateInterface $form_sta * object emerges out of refactoring. */ public function buildOptionForm(ViewUI $view, $id, $option, $display) { + $executable = $this->executableFactory->get($view); + $executable->initDisplay(); + $option_build = array(); $option_build['#theme'] = 'views_ui_display_tab_setting'; $option_build['#description'] = $option['title']; - $option_build['#link'] = $view->getExecutable()->displayHandlers->get($display['id'])->optionLink($option['value'], $id, '', empty($option['desc']) ? '' : $option['desc']); + $option_build['#link'] = $executable->displayHandlers->get($display['id'])->optionLink($option['value'], $id, '', empty($option['desc']) ? '' : $option['desc']); $option_build['#links'] = array(); if (!empty($option['links']) && is_array($option['links'])) { foreach ($option['links'] as $link_id => $link_value) { - $option_build['#settings_links'][] = $view->getExecutable()->displayHandlers->get($display['id'])->optionLink($option['setting'], $link_id, 'views-button-configure', $link_value); + $option_build['#settings_links'][] = $executable->displayHandlers->get($display['id'])->optionLink($option['setting'], $link_id, 'views-button-configure', $link_value); } } - if (!empty($view->getExecutable()->displayHandlers->get($display['id'])->options['defaults'][$id])) { + if (!empty($executable->displayHandlers->get($display['id'])->options['defaults'][$id])) { $display_id = 'default'; $option_build['#defaulted'] = TRUE; } else { $display_id = $display['id']; - if (!$view->getExecutable()->displayHandlers->get($display['id'])->isDefaultDisplay()) { - if ($view->getExecutable()->displayHandlers->get($display['id'])->defaultableSections($id)) { + if (!$executable->displayHandlers->get($display['id'])->isDefaultDisplay()) { + if ($executable->displayHandlers->get($display['id'])->defaultableSections($id)) { $option_build['#overridden'] = TRUE; } } @@ -931,7 +953,7 @@ public function buildOptionForm(ViewUI $view, $id, $option, $display) { * Add information about a section to a display. */ public function getFormBucket(ViewUI $view, $type, $display) { - $executable = $view->getExecutable(); + $executable = $this->executableFactory->get($view); $executable->setDisplay($display['id']); $executable->initStyle(); diff --git a/core/modules/views_ui/src/ViewListBuilder.php b/core/modules/views_ui/src/ViewListBuilder.php index cc11d8e..9338ab5 100644 --- a/core/modules/views_ui/src/ViewListBuilder.php +++ b/core/modules/views_ui/src/ViewListBuilder.php @@ -14,6 +14,7 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Url; +use Drupal\views\ViewExecutableFactory; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -31,13 +32,21 @@ class ViewListBuilder extends ConfigEntityListBuilder { protected $displayManager; /** + * The factory to load a view executable with. + * + * @var \Drupal\views\ViewExecutableFactory + */ + protected $executableFactory; + + /** * {@inheritdoc} */ public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( $entity_type, $container->get('entity.manager')->getStorage($entity_type->id()), - $container->get('plugin.manager.views.display') + $container->get('plugin.manager.views.display'), + $container->get('views.executable') ); } @@ -50,11 +59,14 @@ public static function createInstance(ContainerInterface $container, EntityTypeI * The entity storage class. * @param \Drupal\Component\Plugin\PluginManagerInterface $display_manager * The views display plugin manager to use. + * @param \Drupal\views\ViewExecutableFactory $executable_factory + * The factory to load a view executable with. */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, PluginManagerInterface $display_manager) { + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, PluginManagerInterface $display_manager, ViewExecutableFactory $executable_factory) { parent::__construct($entity_type, $storage); $this->displayManager = $display_manager; + $this->executableFactory = $executable_factory; } /** @@ -257,7 +269,7 @@ protected function getDisplaysList(EntityInterface $view) { */ protected function getDisplayPaths(EntityInterface $view) { $all_paths = array(); - $executable = $view->getExecutable(); + $executable = $this->executableFactory->get($view); $executable->initDisplay(); foreach ($executable->displayHandlers as $display) { if ($display->hasPath()) {