Forums / General / get embedded image in short_description
paul bolger
Wednesday 01 June 2011 5:52:45 am
I need to pull an image in the short_description field in a folder. If I use
$child.object.data_map.short_description.object.embedded_contentobject_array.0.current.data_map.image
I seem to get all the embedded objects for the object rather than just the ones in short_description - and in no particular order. How do I call just one field?
Paul Bolger
Peter Keung
Wednesday 01 June 2011 7:28:43 am
Try using the related_objects fetch and specifying an attribute:
http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/related_objects
http://www.mugo.ca Mugo Web, eZ Partner in Vancouver, Canada
Thursday 02 June 2011 6:46:58 pm
Thanks Peter, I'll give that a try.
Seems a bit crazy that you can't directly get the embedded objects out of a particular xml field. Has this changed since 3.x? I used the line above in a project a few years ago (3.8) and it seemed to work ok then.