I’ve got a contenttype “gallery” with an imagefield “thumbnail”, used in listviews oder teaserviews. This contenttype also has a field collection with “image”, “title” and “description”. So what would be great now, if there’s no value set for the “thumbnail” field, the default value should be the value from the first field-collection image.
any chance to realize this? Thanks for your help
EDIT:
i tried this:
That’s not a solution
function channelportal_gallery_node_presave($node) { $galleryimage = field_get_items('node', $node, 'field_gallery_and_caption'); $firstimageID = $galleryimage[0]['value']; $item = field_collection_item_load($firstimageID); dpm($node->field_thumbnail); $node->field_thumbnail = field_get_items('field_collection_item', $item, 'field_gallery_image'); dpm($node->field_thumbnail); }
But nothing is stored, to the field, even if the first dpm gives back an empty array and the second one containing the values it should contain. But after all, nothing is stored to the field and it’s empty again…
Thanks for your answer Chad Payne
Sponsored by SupremePR