I figured this would be a breeze given the nifty node based concept of Node Gallery - but alas, ran into a show stopper in the last step of the process. This is what I did:
- I installed Node Gallery & Node Gallery API into a drupal 7.16 default test installation with not very many other modules running at the moment (just basics like views, chaos tools and similar)
- seeing Node Gallery had unsatisfied dependencies, I also installed file_entity-7.x-2.0-unstable7 and file_entity_link-7.x-1.0-alpha2 (as the latest available) and enabled them all.
- the default gallery relationship was created, I added a gallery instance with a few test files and then went to add a field onto the article content type.
- It was looking great: in the existing file types dropdown there was a lovely Entity Reference: node_gallery_ref_1 option which I selected and widgeted as a dropdown list,
- and left the field settings at default (Target type: Node, Entity Selection mode: Node Gallery, Node Gallery Behavior).
- the display I set to "rendered entity", view mode : teaser.
- Then I moved to a sample article I had created and selected my test gallery via the new dropdown, giving me a fine preview of the desired result: the teaser view of the associated gallery under the article content.
- But lo, saving this put an end to the smooth ride: the gallery reference wasn't added, instead I got this error message:
Notice: Trying to get property of non-object in NodeGalleryBehaviorHandler->NodeGalleryRelationshipCrud() (line 84 of W:\sli\drupal\sites\all\modules\node_gallery\plugins\entityreference\behavior\NodeGalleryBehaviorHandler.class.php).
EntityMalformedException: Missing bundle property on entity of type node_gallery_relationship. in entity_extract_ids() (line 7562 of W:\sli\drupal\includes\common.inc).The website encountered an unexpected error. Please try again later.
Well. Later didn't help.
So, where did I go wrong?
I'll be happy to supply any further information that could help to resolve this.
Many thanks in advance!
Comment | File | Size | Author |
---|---|---|---|
#1 | 1846806-node_gallery_api-relationship-insert-error.patch | 1.18 KB | zengenuity |
Comments
Comment #1
zengenuity CreditAttribution: zengenuity commentedAre you saying you installed Node Gallery, so you got the default Gallery and Gallery Item types. Then, you added node_gallery_ref_1 to the Article content type manually from the content type manage fields interface? If so, that's not the way you're supposed to do it. You need to edit the Node Gallery Relationship Type under Configuration, Content Authoring, Node Gallery. From there, you can add more item types to a gallery relationship type. (it will take care of the reference fields for you)
Attached is a patch that will prevent the error when you add the field manually. (though, it doesn't make that way work...just prevents the fatal error)
Comment #2
calliandra CreditAttribution: calliandra commentedthanks for the quick reply, zengenuity
I tried to do as you suggested but, if I understood you rightly, this goes in a direction I don't actually want.
In short, the article then acts kind of like an anonymous, fixed instance gallery in this case.
So...
maybe I need to step back and be more precise about what I do want:
Doing as I described, I got exactly the Gallery selector I wanted (1.), and even the teaser display (2.), but only in preview mode.
So, if you're saying the way I did it is not meant to go well, how else can this be achieved?
Thanks again!
Comment #3
scroogie CreditAttribution: scroogie commentedI think you simply want a reference to the gallery in your article type. Try adding a seperate entity reference or any other reference implementation like node reference field to your article type.
Comment #4
calliandra CreditAttribution: calliandra commentedI went and added a new field as suggested, and this works just fine.
Playing around with the settings however, I discovered that what generated the error I first mentioned was actually not my choice of field but the setting:
Entity Selection mode: Node Gallery
This just won't work.
Using the "Simple" mode and specifying "Gallery" as the bundles to made available for selection does.
I went back and tried reusing the already available Entity Reference: node_gallery_ref_1 and set the Entity Selection mode to Simple (with optional filter by bundle).
And lo, this works just as well. hm...
This leads me to the question whether there is anything that actually speaks against using (the already existing) - Entity Reference: node_gallery_ref_1 for creating the gallery selection dropdown as opposed to creating a new reference field of its own? What is it usually meant to be used for?
And what is the Selection Mode: Node Gallery designed to be used for?
Thanks again!
Comment #5
zengenuity CreditAttribution: zengenuity commentedIf you change the node_gallery_ref_1 selection mode to Simple, I think you will break the gallery functionality. At the very least, you are going to break the selection handling that is usually determined by the relationship type settings. (which content types are galleries and items) Node Gallery Selection Mode allows NG to override some defaults in Entity Gallery and handle selection and saving behavior.
For what you want to achieve, you definitely want to do what @scroogie said in #3.
Comment #6
zengenuity CreditAttribution: zengenuity commentedErr...EntityReference I meant, not Entity Gallery.
Comment #7
zengenuity CreditAttribution: zengenuity commentedCommitted patch from #1 to dev.