Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23807

Unable to preview first draft of a content if controller uses viewLocation()

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: High High
    • 2015.09
    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ricardo.correia-obsolete@ez.no Ricardo Correia (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: