Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

CustomLocationControllerChecker.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\MVC\Symfony\View;
8
9 use eZ\Publish\API\Repository\Values\Content\Content;
10 use eZ\Publish\API\Repository\Values\Content\Location;
11
15 class CustomLocationControllerChecker
16 {
18 private $viewProviders;
19
31 public function usesCustomController(Content $content, Location $location, $viewMode = 'full')
32 {
33 $contentView = new ContentView(null, [], $viewMode);
34 $contentView->setContent($content);
35 $contentView->setLocation($location);
36
37 foreach ($this->viewProviders as $viewProvider) {
38 $view = $viewProvider->getView($contentView);
39 if ($view instanceof View) {
40 if ($view->getControllerReference() !== null) {
41 return true;
42 }
43 }
44 }
45
46 return false;
47 }
48
52 public function addViewProviders(array $viewProviders)
53 {
54 $this->viewProviders = $viewProviders;
55 }
56 }
eZ\Publish\API\Repository\Values\Content\Content
Definition: Publish/API/Repository/Values/Content/Content.php:21
eZ\Publish\API\Repository\Values\Content\Location
Definition: API/Repository/Values/Content/Location.php:32
eZ\Publish\Core\MVC\Symfony\View\ContentView
Main object to be rendered by the View Manager when viewing a content.
Definition: Publish/Core/MVC/Symfony/View/ContentView.php:40
eZ\Publish\Core\MVC\Symfony\View\CustomLocationControllerChecker
Used to check if a Location is rendered using a custom controller.
Definition: CustomLocationControllerChecker.php:16
eZ\Publish\Core\MVC\Symfony\View\CustomLocationControllerChecker\addViewProviders
addViewProviders(array $viewProviders)
Definition: CustomLocationControllerChecker.php:52
eZ\Publish\Core\MVC\Symfony\View\CustomLocationControllerChecker\$viewProviders
$viewProviders
Definition: CustomLocationControllerChecker.php:18
eZ\Publish\Core\MVC\Symfony\View\CustomLocationControllerChecker\usesCustomController
usesCustomController(Content $content, Location $location, $viewMode='full')
Tests if $location has match a view that uses a custom controller.
Definition: CustomLocationControllerChecker.php:31
eZ\Publish\Core\MVC\Symfony\View\View
Main interface for Views of Value objects (content, block...).
Definition: Publish/Core/MVC/Symfony/View/View.php:16
eZ\Publish\Core\MVC\Symfony\View
Definition: BaseView.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.