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

Specify version for related objects fetch

    XMLWordPrintable

Details

    Description

      I have a embedded a block to manipulate related objects in the frontend siteaccess using the following code:

      {foreach $object.related_contentobject_array as $child}
        {content_view_gui content_object  = $child
                          view            = first_set($view, 'edit-embed')
                          parent_id       = $object.id
                          parent_version  = $edit_version
                          parent_language = $edit_language|not|choose(concat($edit_language,"/"),'')}
      {/foreach}
      
      <button name="UploadFileRelationButton">Add new {$typetext}</button>
      <button name="BrowseObjectButton">Link existing {$typetext}</button>
      <button name="DeleteRelationButton">Remove {$typetext}(s)</button>
      

      This works correct when creating new objects (ie when a relation is added or removed it is updated in the //draft version//) this works as expected.
      On the other hand if I edit a existing object the changes are not displayed until you actually publish.

      The cause of this is //eZContentObject::relatedObjects// uses CurrentVersion which defaults to the current published version and not to the draft version.

      To overcome this issue I have created a patch that allows the //content/related_objects// fetch function to take 1 more parameter: version.

      Patch is located at github: https://github.com/ezsystems/ezpublish/pull/395

      Attachments

        Activity

          People

            unknown unknown
            lafka lafka
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: