Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
when you have an image inside the field collection and
do a preview of the node, the image doesn't appear.
Is there a solution for this behavior?
Thank you!
Comment | File | Size | Author |
---|---|---|---|
#29 | field_collection-Entitymalformedexception_preview-1447338-29.patch | 2 KB | Andrew Answer |
#12 | fetch_field_collection_images_when_previewing-1447338-12.patch | 2.04 KB | colan |
#9 | 2.png | 2.79 KB | madelyncruz |
#9 | 1.png | 3.71 KB | madelyncruz |
#7 | image-preview-missing-1447338-7.patch | 1.28 KB | colinafoley |
Comments
Comment #1
quasi CreditAttribution: quasi commentedStill no luck with this issue.
Comment #2
burgs CreditAttribution: burgs commentedThis is an issue with all filefields inside field collections.
Comment #3
quasi CreditAttribution: quasi commentedIs there a solution to this problem?
Thank you!
Comment #4
mgriebe CreditAttribution: mgriebe commentedI concur that this is an active issue. I have a field_slideshow and a field collection with a single image. These are the warnings I get when I preview a field collection with a slideshow:
This is the warning I get when I have a simple field collection with an Image field:
Since it is happening in both collection types I suspect it is related. Thanks in advance for your suggestions.
Comment #5
mrprasa CreditAttribution: mrprasa commentedI am having this issue of my images in the field collection not displaying in preview mode. Is this still an open issue? I was trying to use field collection for my slideshow and carousels (two separate items - the carousel is not a pager) because I wanted to create multiple slide groups containing an image, caption, and link. It works great except that users can't preview their work. Any suggestions would be greatly appreciated. I am getting the Notice: Undefined index: uri in theme_image_formatter() error.
Comment #6
garamani CreditAttribution: garamani commentedhi mrparsa
I had the same problem and the same warning!
I solved the problem this way:
1. go here: structure>field collections>manage display
2.change the format to: "Rendered file" (notice: I've installed "Media" module)
3.click on the gear icon.
4.change the view mode to: large, small or medium
and 5.save
hope this works for you
Comment #7
colinafoley CreditAttribution: colinafoley commentedSo, this seems pretty sloppy to me. I feel like having to get the field_instances and field_info at this step is wrong, but I didn't know how else to do this in a generic way.
This patch works at the
FieldCollectionItemEntity
level so it fixes this issue for bothfield_collection
andfield_collection_table
. I chatted with tim.plunkett on IRC and he suggested usinghook_field_formatter_prepare_view()
initially. I was dissatisfied after exploring this approach because it would have required an additional patch forfield_collection_table
. Additionally, I really feel the issue is at theFieldCollectionItemEntity
level since it seems like sometimes the necessary field data is being loaded (viewing the entity) and sometimes it is not being loaded (previewing the entity).Please note: This is only a fix for image fields, not all file fields.
Comment #8
madelyncruz CreditAttribution: madelyncruz commented#7 method doesn't work
Comment #9
madelyncruz CreditAttribution: madelyncruz commentedI have solved the problem without applying any patches, all you have to do is to add to the 'Relationship' field of it then add the image field to the fields section then select the 'Relationship' of the field collection image field.
Comment #10
Tobias Xy CreditAttribution: Tobias Xy commentedMy problem was:
I want to preview a node with a "normal" image field and a field collection containing an image field
and I got the
Notice: Undefined index: uri in theme_image_formatter()
error.No views included!
For me #7 is working flawlessly, so I guess there are multiple issues?
BTW: During my debugging I came to the solution that field_collection_field_load as an implementation of hook_field_load is missing, but since I'm not very familar with the code of field collections and #7 is working for me, I guess I'm wrong here. ;-)
Comment #11
aucovic CreditAttribution: aucovic commentedPatch #7 works well on beta5 module version. I hope they will fix this bug and realase stable version soon.
Thx colinafoley, great work!
Comment #12
colan@colinafoley: Thanks for your work on #7. It didn't work for me when adding a new translation with Entity Translation. The language code wasn't coming through. To fix, I got it from the environment.
Comment #13
colanSorry, forgot an isset().
Comment #14
kristofferwiklund CreditAttribution: kristofferwiklund commentedThe patch did not solve my problem.
- I have a content type with a field collection and inside the field collection is a image field.
- Editing an existing node and uploading a image.
- Clicking the preview button
- Missing image for "Preview full version" and the following error message:
"Notice: Undefined index: uri in theme_image_formatter() (line 602 of /var/aegir/platforms/20140916/modules/image/image.field.inc)."
Comment #15
justanothermark CreditAttribution: justanothermark commentedThe patch is #13 seems to rely on the field using the language whereas by default it seems to use LANGUAGE_NONE even when the $language_code global is set. I've updated the patch to use LANGUAGE_NONE if the field doesn't contain an array key for the current language.
I've also extended the patch to work for other file fields by merging in the whole of the loaded object and not just the URI.
Comment #17
Arlina CreditAttribution: Arlina commentedPatch in #15 works correctly (tested on 7.x-1.0-beta8).
Thanks!
Comment #18
alemadlei#15 worked for me too on beta8
Comment #19
alemadlei#15 worked for me too on beta8
Comment #20
yce CreditAttribution: yce at Pronovix commentedHi!
I've recreated the patch for beta9, and it works great for me too! Thanks!
Comment #21
yce CreditAttribution: yce at Pronovix commentedComment #22
yce CreditAttribution: yce at Pronovix commentedSorry, I got the comment number right this time :)
Comment #23
jmuzz CreditAttribution: jmuzz commentedI agree with the original author of this patch @colinafoley that there is likely a better solution. Please test this patch. It worked in for me for an image field inside field collections nested 1 and 2 levels deep on a new unsaved node, but I haven't tested other cases.
Edit: The first line in the function has no purpose and should be removed before committing.
Comment #24
Andrew Answer CreditAttribution: Andrew Answer commented#22 works for me.
Comment #25
jmuzz CreditAttribution: jmuzz commentedPlease test #23.
Even the original author of #22 is not happy with that solution and he explained why when he posted it in #7.
Comment #26
izus CreditAttribution: izus commentedHi,
I tested patch #23 and it works for Preview of existing content but not when creating a new content.
Following patch is an aggregation of patch #23 + a fix for the new creating nodes.
This is now working for both :)
Comment #27
OleksiyThanks a lot! Patch #26 works for me on node add preview.
Comment #28
Chris Matthews CreditAttribution: Chris Matthews commentedThe patch in #26 does not apply to the latest 7.x-1.x dev snapshot and may be too old to reroll, but I went ahead and tagged the issue accordingly.
Comment #29
Andrew Answer CreditAttribution: Andrew Answer commentedRe-rolled.
Comment #30
Andrew Answer CreditAttribution: Andrew Answer commentedComment #32
ram4nd CreditAttribution: ram4nd as a volunteer commented