You are here

class ViewExecutableFactory in Drupal 9

Same name and namespace in other branches
  1. 8 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
Contains \Drupal\Tests\views_ui\Unit\ViewListBuilderTest.

... 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 12

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.
   */
  public function __construct(AccountInterface $user, RequestStack $request_stack, ViewsData $views_data, RouteProviderInterface $route_provider) {
    $this->user = $user;
    $this->requestStack = $request_stack;
    $this->viewsData = $views_data;
    $this->routeProvider = $route_provider;
  }

  /**
   * 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);
    $view_executable
      ->setRequest($this->requestStack
      ->getCurrentRequest());
    return $view_executable;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
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.