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

Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController Class Reference

This controller provides the content view feature. More...

Inheritance diagram for eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController:

## Public Member Functions
| __construct (ViewManagerInterface $viewManager, AuthorizationCheckerInterface $authorizationChecker)
| viewAction (ContentView $view)
| This is the default view action or a ContentView object. More...
| embedAction (ContentView $view)
| Embed a content. More...
| viewLocation ($locationId, $viewType, $layout=false, array $params=[])
| Main action for viewing content through a location in the repository. More...
| viewContent ($contentId, $viewType, $layout=false, array $params=[])
| Main action for viewing content. More...
Public Member Functions inherited from eZ\Publish\Core\MVC\Symfony\Controller\Controller
| getParameter ($parameterName, $defaultValue=null)
| Returns value for $parameterName and fallbacks to $defaultValue if not defined. More...
| hasParameter ($parameterName)
| Checks if $parameterName is defined. More...
| getConfigResolver ()
| render ($view, array $parameters=[], Response $response=null)
| Renders a view. More...
| getTemplateEngine ()
| getLogger ()
| getRepository ()
| getRequest ()
| getEventDispatcher ()
| isGranted (AuthorizationAttribute $attribute)
| Checks if current user has granted access to provided attribute. More...

## Protected Member Functions
| buildResponse ($etag=null, DateTime $lastModified=null)
| Build the response so that depending on settings it's cacheable. More...
| handleViewException (Response $response, $params, Exception $e, $viewType, $contentId=null, $locationId=null)
| renderLocation (Location $location, $viewType, $layout=false, array $params=[])
| Creates the content to be returned when viewing a Location. More...
| renderContent (Content $content, $viewType, $layout=false, array $params=[])
| Creates the content to be returned when viewing a Content. More...
| performAccessChecks ()
| Performs the access checks. More...

## Protected Attributes
| $viewManager

## Private Attributes
| $authorizationChecker

## Detailed Description

This controller provides the content view feature.

Since
  6.0.0 All methods except `view()` are deprecated and will be removed in the future.

Definition at line 32 of file ViewController.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController::__construct | ( | ViewManagerInterface | $viewManager,
|  | AuthorizationCheckerInterface | $authorizationChecker
| ) |  |

Definition at line 40 of file ViewController.php.

References eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\$authorizationChecker, and eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\$viewManager.

## Member Function Documentation

## ◆ buildResponse()

eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController::buildResponse | ( |  | $etag = `null`,
|  | DateTime | $lastModified = `null`
| ) |  |
| protected

Build the response so that depending on settings it's cacheable.

Parameters

  string | null | $etag |
  \DateTime | null | $lastModified |

Returns
  \Symfony\Component\HttpFoundation\Response

Definition at line 88 of file ViewController.php.

References eZ\Publish\Core\MVC\Symfony\Controller\Controller\getParameter(), and eZ\Publish\Core\MVC\Symfony\Controller\Controller\getRequest().

Referenced by eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\viewContent(), and eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\viewLocation().

## ◆ embedAction()

eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController::embedAction | ( | ContentView | $view | ) |

Embed a content.

Behaves mostly like viewAction(), but with specific content load permission handling.

Parameters

  \eZ\Publish\Core\MVC\Symfony\View\ContentView | $view |

Returns
  \eZ\Publish\Core\MVC\Symfony\View\ContentView

Definition at line 75 of file ViewController.php.

## ◆ handleViewException()

eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController::handleViewException | ( | Response | $response,
|  |  | $params,
|  | Exception | $e,
|  |  | $viewType,
|  |  | $contentId = `null`,
|  |  | $locationId = `null`
| ) |  |
| protected

Definition at line 396 of file ViewController.php.

References eZ\Publish\Core\MVC\Symfony\MVCEvents\API_CONTENT_EXCEPTION, and eZ\Publish\Core\MVC\Symfony\Controller\Controller\getEventDispatcher().

Referenced by eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\viewContent(), and eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\viewLocation().

## ◆ performAccessChecks()

eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController::performAccessChecks | ( |  | ) |
| protected

Performs the access checks.

Definition at line 454 of file ViewController.php.

References eZ\Publish\Core\MVC\Symfony\Controller\Controller\isGranted().

Referenced by eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\viewContent(), and eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\viewLocation().

## ◆ renderContent()

eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController::renderContent | ( | Content | $content,
|  |  | $viewType,
|  |  | $layout = `false`,
|  | array | $params = `[]`
| ) |  |
| protected

Creates the content to be returned when viewing a Content.

Parameters

  Content | $content |
  string | $viewType |
  bool | $layout |
  array | $params |

Returns
  string

Definition at line 446 of file ViewController.php.

Referenced by eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\viewContent().

## ◆ renderLocation()

eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController::renderLocation | ( | Location | $location,
|  |  | $viewType,
|  |  | $layout = `false`,
|  | array | $params = `[]`
| ) |  |
| protected

Creates the content to be returned when viewing a Location.

Parameters

  Location | $location |
  string | $viewType |
  bool | $layout |
  array | $params |

Returns
  string

Definition at line 431 of file ViewController.php.

Referenced by eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\viewLocation().

## ◆ viewAction()

eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController::viewAction | ( | ContentView | $view | ) |

This is the default view action or a ContentView object.

It doesn't do anything by itself: the returned View object is rendered by the ViewRendererListener into an HttpFoundation Response.

This action can be selectively replaced by a custom action by means of content_view configuration. Custom actions can add parameters to the view and customize the Response the View will be converted to. They may also bypass the ViewRenderer by returning an HttpFoundation Response.

Cache is in both cases handled by the CacheViewResponseListener.

Parameters

  \eZ\Publish\Core\MVC\Symfony\View\ContentView | $view |

Returns
  \eZ\Publish\Core\MVC\Symfony\View\ContentView

Definition at line 62 of file ViewController.php.

## ◆ viewContent()

eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController::viewContent | ( |  | $contentId,
|  |  | $viewType,
|  |  | $layout = `false`,
|  | array | $params = `[]`
| ) |  |

Main action for viewing content.

Response will be cached with HttpCache validation model (Etag).

Parameters

  int | $contentId |
  string | $viewType |
  bool | $layout |
  array | $params |

Exceptions

Definition at line 280 of file ViewController.php.

References eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\buildResponse(), eZ\Publish\Core\MVC\Symfony\Controller\Controller\getRepository(), eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\handleViewException(), eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\performAccessChecks(), and eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\renderContent().

## ◆ viewLocation()

eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController::viewLocation | ( |  | $locationId,
|  |  | $viewType,
|  |  | $layout = `false`,
|  | array | $params = `[]`
| ) |  |

Main action for viewing content through a location in the repository.

Response will be cached with HttpCache validation model (Etag).

Parameters

  int | $locationId |
  string | $viewType |
  bool | $layout |
  array | $params |

Exceptions

Definition at line 136 of file ViewController.php.

References eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\buildResponse(), eZ\Publish\Core\MVC\Symfony\Controller\Controller\getRepository(), eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\handleViewException(), eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\performAccessChecks(), and eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\renderLocation().

## Member Data Documentation

## ◆ $authorizationChecker

eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController::$authorizationChecker
| private

Definition at line 38 of file ViewController.php.

Referenced by eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\__construct().

## ◆ $viewManager

eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController::$viewManager
| protected

Definition at line 35 of file ViewController.php.

Referenced by eZ\Publish\Core\MVC\Symfony\Controller\Content\ViewController\__construct().

The documentation for this class was generated from the following file:

- ViewController.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.