The has_default_panel() method in PanelizerEntityDefault does not check the displays to see if a default panel exists. After #2012270: Allow default Panelizer to be selected was committed, the logic needs to check if the default display exists.

Comments

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new3.81 KB

Initial patch. The rest of the system needs refactoring accordingly as the API was extended with some new functions.

damienmckenna’s picture

Priority: Normal » Major
Status: Needs review » Needs work

This patch causes problems when an entity is first Panelized, it makes it impossible to get to the page to modify the new display as it doesn't really exist yet.

damienmckenna’s picture

There's a problem with the static caching that caused #2305681: Panelizer display used in Views preview, not on actual page output to occur.

andrew m riley’s picture

Status: Needs work » Needs review
StatusFileSize
new4.26 KB
new1.47 KB

The static check was causing the additional defaults to never load (in my case it was loading the main page panelizer defaults for the page bundle.) I'm attaching a patch that moves the static to a privately scoped variable for the object that still allows for caching but allows for additional defaults to be loaded.

damienmckenna’s picture

StatusFileSize
new4.36 KB

Thanks for fixing my facepalm-worthy bug.

Reviewing the updated code, is there any reason to use the $entity_type in the keys for $this->displays_loaded, especially when get_default_panelizer_objects() is passed the bundle name? Need to test this.

    // If no check was performed already to see if displays exist for this
    // bundle, try loading them.
    if (empty($this->displays_loaded[$bundle])) {
      $this->displays_loaded[$bundle] = TRUE;
      $displays = $this->get_default_panelizer_objects($bundle);
      $this->displays = array_merge($this->displays, $displays);
    }
damienmckenna’s picture

StatusFileSize
new5.09 KB

Fixes a problem where entities were not being displayed if the default was changed and the ':default' display didn't exist or was disabled.

damienmckenna’s picture

Status: Needs review » Fixed

Committed. Thanks for the help, Andrew!

  • DamienMcKenna committed 470a35b on 7.x-3.x
    Issue #2302867 by DamienMcKenna, Andrew M Riley: has_default_panel() did...
damienmckenna’s picture

Status: Fixed » Needs review
StatusFileSize
new4.23 KB

A follow-up to resolve an issue during hook_entity_load().

damienmckenna’s picture

Status: Needs review » Fixed

Committed. Again.

  • DamienMcKenna committed d3492e7 on 7.x-3.x
    Issue #2302867 by DamienMcKenna: Resolve problems in hook_entity_load().
    

Status: Fixed » Closed (fixed)

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