Right now if you enable panels everywhere without taxonomy module I get a couple of notices:

Notice: Undefined index: entity:taxonomy_term in ctools_context_entity_get_child() (line 32 of .../ctools/plugins/contexts/entity.inc).
Strict warning: Creating default object from empty value in panels_everywhere_site_template_add_context() (line 125 of ../panels_everywhere/plugins/tasks/site_template.inc).
Strict warning: Creating default object from empty value in panels_everywhere_site_template_add_context() (line 125 of .../panels_everywhere/plugins/tasks/site_template.inc).

I found code in the panels_everywhere_site_template_get_base_contexts function that depends on the node and the user module also.

My two solution suggestions are:

  1. Wrap the code requiring the modules in modul_exists checks
  2. Add the modules as dependencies in the info file

Comments

emattias’s picture

I think that we should ultimately implement suggestion #1 but in the mean time, here's a patch that implements #2, for the modules that I found code requiring them.

damienmckenna’s picture

Status: Active » Needs work

First off, thanks for the patch.

I believe this is the wrong approach - it shouldn't require more modules, it should instead just have logic that verifies the modules exist before trying to do something; while the user and node modules are required by core, the Taxonomy module is not thus it should not be required by Panels Everywhere either.

(PS, please set issues to "needs review" when you upload a patch.)

slv_’s picture

Title: Panels everywhere requires more modules than specified in info file » panels_everywhere_site_template_add_context() tries to set object properties on NULL contexts
slv_’s picture

Status: Needs work » Needs review
StatusFileSize
new724 bytes

Right, so the issue is that panels_everywhere_site_template_add_context() is called by panels_everywhere_site_template_get_base_contexts() even in cases where some of the contexts it's being called with don't make sense (e.g: User being viewed context in a simple static page like "my-page").

As such, in some cases the $context argument passed to panels_everywhere_site_template_add_context() is a NULL, and therefore that warning appears in environments where E_STRICT is enabled for error logging, since the function tries to add some properties to it.

I've attached a simple patch (certainly might not be the most correct), to at least check whether the context is an object, and if it's not, create it as stdClass().

damienmckenna’s picture

Status: Needs review » Needs work

I've confirmed the problem, but the patch doesn't solve it.

damienmckenna’s picture

damienmckenna’s picture

Two errors show:

After enabling the default PE site template and going to admin/structure/pages/site_template, the following shows:

Notice: Undefined index: entity:taxonomy_term in ctools_context_entity_get_child() (line 32 of ctools/plugins/contexts/entity.inc).

Once either the "Selection rules", "Context" or "Content" pages for the site template display results in the following:

Fatal error: Call to undefined method stdClass::is_type() in ctools/includes/context.inc on line 148

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new4.89 KB

This should do it. All that was necessary was to confirm that the Taxonomy module was enabled before loading & creating the contexts.

damienmckenna’s picture

Status: Needs review » Fixed

Committed. Thank you both!

  • DamienMcKenna committed 4ca2b64 on 7.x-1.x
    Issue #2349583 by DamienMcKenna, slv_, emattias: Don't fail if the...
damienmckenna’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Component: Integration with another module » Code
Status: Fixed » Patch (to be ported)

Needs to be backported to D6.

damienmckenna’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new4.45 KB

Ported to D6.

damienmckenna’s picture

Status: Needs review » Fixed

Committed to D6 too.

  • DamienMcKenna committed 0ea57fd on
    Issue #2349583 by DamienMcKenna, slv_, emattias: Don't fail if the...

Status: Fixed » Closed (fixed)

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