class ViewExecutableFactory

Same name in other branches
  1. 9 core/modules/views/src/ViewExecutableFactory.php \Drupal\views\ViewExecutableFactory
  2. 8.9.x core/modules/views/src/ViewExecutableFactory.php \Drupal\views\ViewExecutableFactory
  3. 10 core/modules/views/src/ViewExecutableFactory.php \Drupal\views\ViewExecutableFactory

Defines the cache backend factory.

Hierarchy

Expanded class hierarchy of ViewExecutableFactory

8 files declare their use of ViewExecutableFactory
MediaLibraryUiBuilder.php in core/modules/media_library/src/MediaLibraryUiBuilder.php
ViewAjaxController.php in core/modules/views/src/Controller/ViewAjaxController.php
ViewExecutableFactoryTest.php in core/modules/views/tests/src/Unit/ViewExecutableFactoryTest.php
ViewExecutableTest.php in core/modules/views/tests/src/Kernel/ViewExecutableTest.php
ViewListBuilderTest.php in core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php

... See full list

1 string reference to 'ViewExecutableFactory'
views.services.yml in core/modules/views/views.services.yml
core/modules/views/views.services.yml
1 service uses ViewExecutableFactory
views.executable in core/modules/views/views.services.yml
Drupal\views\ViewExecutableFactory

File

core/modules/views/src/ViewExecutableFactory.php, line 13

Namespace

Drupal\views
View source
class ViewExecutableFactory {
    
    /**
     * Stores the current user.
     *
     * @var \Drupal\Core\Session\AccountInterface
     */
    protected $user;
    
    /**
     * The request stack.
     *
     * @var \Symfony\Component\HttpFoundation\RequestStack
     */
    protected $requestStack;
    
    /**
     * The views data.
     *
     * @var \Drupal\views\ViewsData
     */
    protected $viewsData;
    
    /**
     * The route provider.
     *
     * @var \Drupal\Core\Routing\RouteProviderInterface
     */
    protected $routeProvider;
    
    /**
     * Constructs a new ViewExecutableFactory.
     *
     * @param \Drupal\Core\Session\AccountInterface $user
     *   The current user.
     * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
     *   The request stack.
     * @param \Drupal\views\ViewsData $views_data
     *   The views data.
     * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
     *   The route provider.
     * @param \Drupal\views\Plugin\ViewsPluginManager|null $displayPluginManager
     *   The display plugin manager.
     */
    public function __construct(AccountInterface $user, RequestStack $request_stack, ViewsData $views_data, RouteProviderInterface $route_provider, ?ViewsPluginManager $displayPluginManager = NULL) {
        $this->user = $user;
        $this->requestStack = $request_stack;
        $this->viewsData = $views_data;
        $this->routeProvider = $route_provider;
        if ($this->displayPluginManager === NULL) {
            @trigger_error('Calling ' . __METHOD__ . ' without the $displayPluginManager argument is deprecated in drupal:10.3.0 and it will be required in drupal:12.0.0. See https://www.drupal.org/node/3410349', E_USER_DEPRECATED);
            $this->displayPluginManager = \Drupal::service('plugin.manager.views.display');
        }
    }
    
    /**
     * Instantiates a ViewExecutable class.
     *
     * @param \Drupal\views\ViewEntityInterface $view
     *   A view entity instance.
     *
     * @return \Drupal\views\ViewExecutable
     *   A ViewExecutable instance.
     */
    public function get(ViewEntityInterface $view) {
        $view_executable = new ViewExecutable($view, $this->user, $this->viewsData, $this->routeProvider, $this->displayPluginManager);
        $view_executable->setRequest($this->requestStack
            ->getCurrentRequest());
        return $view_executable;
    }

}

Members

Title Sort descending Modifiers Object type Summary
ViewExecutableFactory::$requestStack protected property The request stack.
ViewExecutableFactory::$routeProvider protected property The route provider.
ViewExecutableFactory::$user protected property Stores the current user.
ViewExecutableFactory::$viewsData protected property The views data.
ViewExecutableFactory::get public function Instantiates a ViewExecutable class.
ViewExecutableFactory::__construct public function Constructs a new ViewExecutableFactory.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.