Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ViewExecutableFactory.php

class ViewExecutableFactory

Defines the cache backend factory.

Hierarchy

  • class \Drupal\views\ViewExecutableFactory

Expanded class hierarchy of ViewExecutableFactory

4 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
ViewsBlockBase.php in core/modules/views/src/Plugin/Block/ViewsBlockBase.php
ViewsMenuLink.php in core/modules/views/src/Plugin/Menu/ViewsMenuLink.php
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.
RSS feed
Powered by Drupal