Hi,

I have many warnings when I access /admin/structure/types/manage/oa_section/panelizer/page_manager/node%3Aoa_section%3Aoa_section_interdoc/context.

Warnings:
Notice: Undefined index: required context in ctools_context_get_relevant_relationships() (line 968 of ... /profiles/openatrium/modules/contrib/ctools/includes/context.inc).
...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpotter’s picture

I don't have that URL on my site. Sounds like you have added your own section layout that contains a widget that requires a certain context that doesn't exist. But since I can't reproduce this on a standard Atrium install I can't really help much.

hosais’s picture

Hi mike,

Your support are really appreicated. The section layout is created by "clone of news section". I just click clone and save, then the new section layout has this error. You can check the link here http://oa2testbed-hosaistk.rhcloud.com/admin/structure/types/manage/oa_section/panelizer/page_manager/node%3Aoa_section%3Aclone_of_oa_section_news/context. administrator-> admin: 123456. The oa2 is a clean installation.

mpotter’s picture

I reproduced this but have no idea what's causing it. These are just warnings so do they actually cause anything else to fail? Otherwise it sounds more like some sort of ctools bug when a widget has an optional context and no required context. Might want to check the ctools or Panelizer issue queues too.

hosais’s picture

In my site, this does not create any problem. I just try to prevent future problems. Also, I have no intention to change context. If I found something I will report.

Thanks.

rivimey’s picture

I'm also seeing lots of warnings.
Notice: Undefined index: required context in ctools_context_get_relevant_relationships() (line 968 of /var/www/knowledge/profiles/openatrium/modules/contrib/ctools/includes/context.inc)

... pic attached ...

I wonder if it relates to:
https://www.drupal.org/node/2341363

mpotter’s picture

Status: Active » Fixed

Please try updating to Open Atrium 2.42. I believe we added a patch to ctools to fix this.

rivimey’s picture

Version: 7.x-2.41 » 7.x-2.42
Status: Fixed » Active

@mpotter we are now using 2.42 and the problem still persists.

I see messages about it on line 968, as above, and placing a breakpoint there with condition:
!isset($relationship['required context'])

shows that there is a Command Button being examined in $relationship:

title = Command Button from Fieldable panel pane (on Fieldable panel pane: Commands [field_commands])
description = Creates a Command Button context from Fieldable panel pane using the field_commands field on Fieldable panel pane.
context = ctools_entity_from_field_context
edit form = ctools_entity_from_field_edit_form
get child = ctools_entity_from_field_get_child
get children = ctools_entity_from_field_get_children
name = entity_from_field:field_commands-fieldable_panels_pane-command_button
context name = field_commands-fieldable_panels_pane-command_button

and it is indeed true there is no 'required context' item.

The $rid was: entity_from_field:field_commands-fieldable_panels_pane-command_button

The stack frame includes:

#0 .../profiles/openatrium/modules/contrib/ctools/includes/context.inc(968): ctools_context_get_relevant_relationships()
#1 .../profiles/openatrium/modules/contrib/ctools/includes/context-admin.inc(203): ctools_context_get_relevant_relationships(Array)
#2 .../profiles/openatrium/modules/contrib/ctools/includes/context-task-handler.inc(511): ctools_context_add_relationship_form('page_manager_co...', Array, Array, Array, Object(stdClass))
#3 [internal function]: ctools_context_handler_edit_context(Array, Array)
#4 .../includes/form.inc(841): call_user_func_array('ctools_context_...', Array)
#5 .../includes/form.inc(350): drupal_retrieve_form('ctools_context_...', Array)
#6 .../profiles/openatrium/modules/contrib/ctools/includes/wizard.inc(125): drupal_build_form('ctools_context_...', Array)
#7 .../profiles/openatrium/modules/contrib/ctools/page_manager/page_manager.admin.inc(939): ctools_wizard_multistep_form(Array, 'form', Array)
#8 .../profiles/openatrium/modules/contrib/ctools/page_manager/page_manager.admin.inc(836): _page_manager_get_operation_content(0, Object(stdClass), Array, Array, Array, Array)
#9 .../profiles/openatrium/modules/contrib/ctools/page_manager/page_manager.admin.inc(444): page_manager_get_operation_content(0, Object(stdClass), Array, Array)
#10 [internal function]: page_manager_edit_page_operation(0, Object(stdClass), 'handlers', 'pm_existing_pag...', 'context')

At first glance, the problem would seem to be that the ctools function assumes that property will be there, though obviously it could be that an empty value for 'required context' is would be the proper thing. Alternatively, I note that the array passed in came from ctools_context_load_contexts() and in there the string 'requiredcontext' appears -- that is, without a space. Could this difference be relevant?

At the time of the breakpoint, $relevant had accumulated these values:

Comment from User (on comment.comment_author)
Message from User (on message.owner)
Node from User (on node.node_author)
File from User (on file_managed.file_owner)
mpotter’s picture

It sounds like you have a page or panelizer template that is using a Command Button widget. None of the out-of-the-box Atrium layouts use that widget, so it must be something you have added on your site.

You probably need to find the panelizer layout or specific node page that is using the Command Button widget and remove/re-add it.

Also check to see if you have any overridden Features on your site.

mpotter’s picture

Status: Active » Postponed (maintainer needs more info)
B-Prod’s picture

Status: Postponed (maintainer needs more info) » Active

For example, this occurs with Open Atrium distributions on the Context tab of a panel (Panels Manager Existing Pages - "node" override).

Some relationship plugins that throws such error:

  • "File from Node (on Node: Primary Image [field_featured_image])"
  • "File from Fieldable panel pane (on Fieldable panel pane: File [field_basic_file_file])"
  • "Taxonomy term from Node (on Node: Categories [field_featured_categories])"
  • etc.

So it seems that the issue is related to the CTools "entity_from_field" plugin. This 2 plugin has "children" but in some case those do not have the "requires context" specified.

Investigating further, it appears that this bug is introduced by the patch provided in #2448989: Cache plugins for ctools_entity_from_field_get_children and added to Panopoly Core in Open Atrium make file : see #2477363: Patches for ctools from OpenAtrium

B-Prod’s picture

I just created a patch to fix this : #2448989-2: Cache plugins for ctools_entity_from_field_get_children

@hosais: Note that it will not apply on the already patched version you are probably using. So here is a patch that should work for you on an already patched version as the one in the Open Atrium distribution.

B-Prod’s picture

Status: Active » Needs review

If the patch fixes your issue (and it should ;-) ), could you also update the status of the related issue #2448989: Cache plugins for ctools_entity_from_field_get_children ?

rivimey’s picture

@mpotter: The page I'm on is 100% OA - no additional stuff needed or changed. The issue happens both using OA's Radix theme and using default Seven theme. The button that (possibly) provokes the error is labelled Add Context and/or Add Relationship. I've attached a snippet screenshot to demonstrate.

@B-Prod: thanks for your patch, I'll have a go.

B-Prod’s picture

You're welcome.

And here is another patch against OA distribution to update the patch to be applied on Panopoly Core when building the distribution.

mpotter’s picture

I'm having hefox review this before we commit it to Atrium.

I *think* it makes sense, but it seems to be doing more that just fixing the bug. Will reply over in the ctools thread with more.

rivimey’s picture

B-Prod, mpotter, any chance of a version of the actual patch that applies to OA so that I can test?

mpotter’s picture

Responded over in the ctools issue. Can we keep the discussion in one place?

  • hefox committed a972815 on 7.x-2.x
    Issue #2490514: update patch
    
hefox’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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