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.
I am seeing the following error when using page manager (admin/structure/pages)->node_view->contexts tab.
Notice: Undefined variable: plugins in field_collection_field_collection_from_field_get_children() (line 65 of /data/www/intranet/profiles/wetkit/modules/contrib/field_collection/ctools/relationships/field_collection_from_field.inc).
Warning: array_merge(): Argument #1 is not an array in ctools_get_plugins() (line 281 of /data/www/intranet/profiles/wetkit/modules/contrib/ctools/includes/plugins.inc).
Due to this error the relationship dropdown is not showing, so I am unable to add any relationships to my panel page. In looking at the code it appears that the $plugins variable which is returned in function field_collection_field_collection_from_field_get_children is not initialized earlier in the function. Initializing the variable gets rid of the error message and the relationship dropdown then shows.
Screenshot attached, patch to follow.
Comment | File | Size | Author |
---|---|---|---|
#1 | field_collection_panels_relationship-2159395.patch | 662 bytes | joel_osc |
screenshot8.png | 80.64 KB | joel_osc |
Comments
Comment #1
joel_osc CreditAttribution: joel_osc commentedComment #2
rakesh.nimje84@gmail.com CreditAttribution: rakesh.nimje84@gmail.com commentedThe solution provided in #1 is working in my case. Thank You!!!
Comment #3
lmeurs CreditAttribution: lmeurs commentedCan confirm the patch works, thanks!
Comment #4
jmuzz CreditAttribution: jmuzz commentedI wasn't able to duplicate the error. I made a basic node type with a field collection that had some text fields and set up a variant with default settings for node view. The contexts tab has no error message and the relationships dropdown is working.
Can you provide more specific steps to reproduce the error?
Comment #5
lmeurs CreditAttribution: lmeurs commented@jmuzz: You probably do not need to add a field collection. The problem occurs in
field_collection_field_collection_from_field_get_children()
whenfield_info_instances()
returns an array without afield_collection_item
element. When you look atfield_collection_field_collection_from_field_get_children()
you'll see that the function then returns$plugins
whithout initiating it first, which is done by the patch.I just reproduced the 'bug' using simplytest.me with Field collection, Panels and Page manager. I enabled the Node template at
admin/structure/pages
, created a variant and visited the variant's Contexts page atadmin/structure/pages/nojs/operation/node_view/handlers/node_view_panel_context/context
.Comment #6
jmuzz CreditAttribution: jmuzz commentedCan confirm these steps produce the error on simplytest.me . I will try to take another look at it soon and may be able to commit it.
Comment #7
subspaceeddy CreditAttribution: subspaceeddy commentedI had this issue and can confirm the patch fixes it.
Comment #9
jmuzz CreditAttribution: jmuzz commented