I'm running into an this error

Notice: Undefined index: relationship_field_collection_from_field:node:page:field_[name] in theme_ctools_context_list() (line 230 of ...

I have a bit of an edge case setup:
- Panelizer node display
- 2 contexts to the same field collection:
-- 1 used on the node itself
-- 1 used on the taxonomy term that for which the node has a term reference to

If one of those field collections is empty, the same context get used in each instance resulting in displays of duplicate data.

Comments

sheise’s picture

StatusFileSize
new1.07 KB

Here's a patch.

sheise’s picture

Status: Active » Needs review
jedihe’s picture

StatusFileSize
new1.07 KB

I'm re-rolling the patch to apply on top of 7.x-1.0-beta7. For 7.x-1.x-dev, sheise's patch (#1) is the correct one.

jedihe’s picture

Status: Needs review » Reviewed & tested by the community

I just tested the patch manually and can confirm that it works. I was seeing a 4-valued field collection creating the very same context value for deltas 1, 2, 3 (no value set on those) as for delta 0 (with a value set) before I applied the patch. Once I applied it, the duplicated contexts didn't show up anymore and the notices were fixed. I tested on 7.x-1.0-beta7, but I think it holds true for the current dev version.

As for the code itself, I think it can be optimized a bit (not adding an extra line to create an empty context), but that's very minor so I think it looks good. Please note I have very basic experience with ctools plugins, so my opinion is qualified mostly from the Drupal point of view.

Setting to RTBC.

maximpodorov’s picture

This fix is worth the new release also.

jmuzz’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new992 bytes

The assigned variable wasn't used for anything so I removed it. This is simpler and should do the same thing. Please let me know if I am missing something.

chris matthews’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #6 is 3 years old, but still applied cleanly to the latest 7.x-1.x-dev snapshot and after reviewing/testing it does indeed do the same thing so I'm changing the status to RTBC.

renatog’s picture

+1 to it

  • RenatoG committed 9f6f903 on 7.x-1.x authored by jmuzz
    Issue #2244719 by sheise, jedihe, jmuzz, maximpodorov, Chris2, RenatoG:...
renatog’s picture

Status: Reviewed & tested by the community » Fixed

Committed to the dev branch.

Thank you very much for the contribution.

Best,

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.