Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / devel / webprofiler / src / Views / ViewExecutableFactoryWrapper.php
1 <?php
2
3 namespace Drupal\webprofiler\Views;
4
5 use Drupal\Core\Routing\RouteProviderInterface;
6 use Drupal\Core\Session\AccountInterface;
7 use Drupal\views\ViewEntityInterface;
8 use Drupal\views\ViewExecutable;
9 use Drupal\views\ViewExecutableFactory;
10 use Drupal\views\ViewsData;
11 use Symfony\Component\HttpFoundation\RequestStack;
12
13 /**
14  * Class ViewExecutableFactoryWrapper
15  */
16 class ViewExecutableFactoryWrapper extends ViewExecutableFactory {
17
18   /** @var ViewExecutable $view_executable */
19   private $views;
20
21   /**
22    * {@inheritdoc}
23    */
24   public function __construct(AccountInterface $user, RequestStack $request_stack, ViewsData $views_data, RouteProviderInterface $route_provider) {
25     parent::__construct($user, $request_stack, $views_data, $route_provider);
26
27     $this->views = [];
28   }
29
30   /**
31    * {@inheritdoc}
32    */
33   public function get(ViewEntityInterface $view) {
34     $view_executable = new TraceableViewExecutable($view, $this->user, $this->viewsData, $this->routeProvider);
35     $view_executable->setRequest($this->requestStack->getCurrentRequest());
36     $this->views[] = $view_executable;
37
38     return $view_executable;
39   }
40
41   /**
42    * @return TraceableViewExecutable
43    */
44   public function getViews() {
45     return $this->views;
46   }
47 }