Details
-
Improvement
-
Resolution: Fixed
-
High
-
5.2, 5.4.0, 5.3.4
-
None
-
eZ Publish 5.2
Description
This issue makes it impossible to preview the first draft of a content if the controller uses viewLocation() method.
For example, as follows, the showBlogPostAction function used to display blog posts uses the viewLocation() method, and this will not work when previewing the first draft of a blog post, since a location doesn't exist yet.
public function showBlogPostAction( $locationId, $viewType, $layout = false, array $params = array() ) { // We need the author, whatever the view type is. $repository = $this->getRepository(); $location = $repository->getLocationService()->loadLocation( $locationId ); $author = $repository->getUserService()->loadUser( $location->getContentInfo()->ownerId ); // TODO once the keyword service is available, load the number of keyword for each keyword // Delegate view rendering to the original ViewController // (makes it possible to continue using defined template rules) // We just add "author" to the list of variables exposed to the final template return $this->get( 'ez_content' )->viewLocation( $locationId, $viewType, $layout, array( 'author' => $author ) ); }
The result can be viewed in the attached screenshot.