1 | <?php |
||
30 | class ViewController extends Controller |
||
31 | { |
||
32 | /** @var \eZ\Publish\Core\MVC\Symfony\View\ViewManagerInterface */ |
||
33 | protected $viewManager; |
||
34 | |||
35 | /** @var \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface */ |
||
36 | private $authorizationChecker; |
||
37 | |||
38 | public function __construct(ViewManagerInterface $viewManager, AuthorizationCheckerInterface $authorizationChecker) |
||
43 | |||
44 | /** |
||
45 | * This is the default view action or a ContentView object. |
||
46 | * |
||
47 | * It doesn't do anything by itself: the returned View object is rendered by the ViewRendererListener |
||
48 | * into an HttpFoundation Response. |
||
49 | * |
||
50 | * This action can be selectively replaced by a custom action by means of content_view |
||
51 | * configuration. Custom actions can add parameters to the view and customize the Response the View will be |
||
52 | * converted to. They may also bypass the ViewRenderer by returning an HttpFoundation Response. |
||
53 | * |
||
54 | * Cache is in both cases handled by the CacheViewResponseListener. |
||
55 | * |
||
56 | * @param \eZ\Publish\Core\MVC\Symfony\View\ContentView $view |
||
57 | * |
||
58 | * @return \eZ\Publish\Core\MVC\Symfony\View\ContentView |
||
59 | */ |
||
60 | public function viewAction(ContentView $view) |
||
64 | |||
65 | /** |
||
66 | * Embed a content. |
||
67 | * Behaves mostly like viewAction(), but with specific content load permission handling. |
||
68 | * |
||
69 | * @param \eZ\Publish\Core\MVC\Symfony\View\ContentView $view |
||
70 | * |
||
71 | * @return \eZ\Publish\Core\MVC\Symfony\View\ContentView |
||
72 | */ |
||
73 | public function embedAction(ContentView $view) |
||
77 | |||
78 | /** |
||
79 | * Build the response so that depending on settings it's cacheable. |
||
80 | * |
||
81 | * @param string|null $etag |
||
82 | * @param \DateTime|null $lastModified |
||
83 | * |
||
84 | * @return \Symfony\Component\HttpFoundation\Response |
||
85 | */ |
||
86 | protected function buildResponse($etag = null, DateTime $lastModified = null) |
||
116 | |||
117 | protected function handleViewException(Response $response, $params, Exception $e, $viewType, $contentId = null, $locationId = null) |
||
141 | |||
142 | /** |
||
143 | * Creates the content to be returned when viewing a Location. |
||
144 | * |
||
145 | * @param Location $location |
||
146 | * @param string $viewType |
||
147 | * @param bool $layout |
||
148 | * @param array $params |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | protected function renderLocation(Location $location, $viewType, $layout = false, array $params = []) |
||
156 | |||
157 | /** |
||
158 | * Creates the content to be returned when viewing a Content. |
||
159 | * |
||
160 | * @param Content $content |
||
161 | * @param string $viewType |
||
162 | * @param bool $layout |
||
163 | * @param array $params |
||
164 | * |
||
165 | * @return string |
||
166 | */ |
||
167 | protected function renderContent(Content $content, $viewType, $layout = false, array $params = []) |
||
171 | |||
172 | /** |
||
173 | * Performs the access checks. |
||
174 | */ |
||
175 | protected function performAccessChecks() |
||
181 | } |
||
182 |