The mvpcreator_theme_current_panels_variant function does a node_load on an entity ID to determine what display it's using. It checks if the handler is 'panelizer_node', then takes the ID in the argument and runs node_load.

However, Panelizer also uses the panelizer_node handler for taxonomy terms. See PanelizerEntityTaxonomyTerm.class.php:

  /**
   * Implements a delegated hook_page_manager_handlers().
   *
   * This makes sure that all panelized entities have the proper entry
   * in page manager for rendering.
   */
  public function hook_default_page_manager_handlers(&$handlers) {
    page_manager_get_task('term_view');

    $handler = new stdClass;
    $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
    $handler->api_version = 1;
    $handler->name = 'term_view_panelizer';
    $handler->task = 'term_view';
    $handler->subtask = '';
    $handler->handler = 'panelizer_node';
    $handler->weight = -100;
    $handler->conf = array(
      'title' => t('Term panelizer'),
      'context' => page_manager_term_view_get_type() == 'multiple' ? 'argument_terms_1' : 'argument_term_1',
      'access' => array(),
    );
    $handlers['term_view_panelizer'] = $handler;

    return $handlers;
  }

This means that when run on a taxonomy term page, the function will return the display of the node with the same ID rather than the one associated with the term.

Instead, the function should check the task name and then either do a node_load or a taxonomy_term_load. If there are more types of tasks that use the panelizer_node handler, the code here will have to account for them.

Comments

cboyden created an issue. See original summary.

cboyden’s picture

Title: mvpcreator_theme_current_panels_variant doesn't handle taxonomy terms » mvpcreator_theme_current_panels_variant doesn't non-node entities
Status: Active » Needs review
StatusFileSize
new1.18 KB

The attached patch adds a switch statement to handle all of the entity types in Panelizer that use the panelizer_node handler.

dsnopek’s picture

Oh, wow! I guess there's still plenty to learn about how Panelizer works. :-) Great catch, thanks!

  • dsnopek committed 7f95899 on 7.x-1.x authored by cboyden
    Issue #2698107 by cboyden: mvpcreator_theme_current_panels_variant doesn...
dsnopek’s picture

Status: Needs review » Fixed

Worked in my testing, committed! Thanks :-)

Status: Fixed » Closed (fixed)

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