Note: The panelizer panel select tab does appear when editing pre-existing nodes. The problem only occurs when adding new nodes.

Repeatable: Always
Steps to repeat:
1. Install standard version of Drupal 7.15
2. Install Panelizer 7.x-3.0-rc1+1-dev, Panels 7.x-3.3+1-dev, Chaos tools 7.x-1.2+3-dev. (have also checked non-dev releases)
3. Tick: panelize, provide default panel, allow panel choice for the basic page (full page override) at admin/config/content/panelizer
3. Create an additional panel for the basic page at admin/config/content/panelizer/node/page.page_manager/list
4. Add a basic page at node/add/page

Expected Results:
Panelizer panel select tab with a select list allowing the user to select the default or other panel

Actual Results:
No Panelizer panel select tab

Thanks in advance for looking into this. And thanks for all your hard work! Am really excited about using panelizer in my future projects.

Andrew

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mrfelton’s picture

Same issue here

er_gaurav_sharma’s picture

Hello there,
Me too have a problem. I enabled allow multiple panel layout and created three templates. But when i create a node there is no option appearing t hat allow me to choose from various panelized template. But surprisingly when i use panoply drupal distribution there it works. So if you really need that feature i advice choose panoply for now or upgrade an existing one to panoply distribution.

Thanks and Regard
Gaurav Sharma

das-peter’s picture

Status: Active » Needs review
FileSize
3.76 KB

Same issue here.
As far as I can tell the issue has two parts:

  1. PanelizerEntityDefault::hook_entity_load() uses PanelizerEntityDefault::has_default_panel() instead PanelizerEntityDefault::is_panelized() to determine whether it has to deal with defaults
  2. PanelizerEntityDefault::hook_field_attach_form() hides the vertical tab based on the last view mode processed in the loop and not per view mode. Correct would be to define the access per widget and the access to the vertical tab is granted as soon as one of the widgets is accessible.

The attached patch does the necessary changes to fix the issues mentioned above.

das-peter’s picture

It looks like this patch uncovered another issue.
panelizer_panels_cache_get() calls panels_common_get_allowed_layouts(), unfortunately panels_common_get_allowed_layouts() doesn't ensure that the panels plugin is loaded (ctools_include('plugins', 'panels');).
Thus you can end up with a fatal error that complains that the function panels_get_layouts() couldn't be found.

I've added ctools_include('plugins', 'panels'); to panelizer_panels_cache_get() in the updated patch to ensure the plugin is really available.
However, I'm not sure if this not better should be part of panels_common_get_allowed_layouts() instead.

das-peter’s picture

Added other adjustments:

  • PanelizerEntityDefault::has_panel_choice() didn't properly call PanelizerEntityDefault::is_panelized. It was called with the bundle only even if a view mode was given.
  • Added exception to PanelizerEntityDefault::panelizer_access() for choice, similar to settings and overview. Needs review!
Andrew Edwards’s picture

Good stuff! It's working well for me. I don't have enough knowledge of panelizer to review the code unfortunately, but it's great to be able to use the layout choice functionality now. Thanks!

szantog’s picture

Status: Needs review » Needs work

Hmm.. It was hard to apply this patch (twice), rerolled against the latest dev.
It works as well, if on content type settings Provide default panel is checked.
If not, then add a new node without panel, save, and edit, the default panel is set as 'default'. It means, if when a node was saved with panelizer, there isn't any chance to "depanelize" it.

szantog’s picture

yep, forgot the patch.

populist’s picture

Status: Needs work » Needs review

I did a review of this patch and it solves the problem I was seeing of the Panel Choice tab not showing up. The patch code looks straight forward enough, but might need another set of eyes.

merlinofchaos’s picture

Status: Needs review » Needs work
          // If no panelizer was loaded for the view mode, queue up defaults.
-        if (empty($panelizers[$entity_id][$view_mode]) && $this->has_default_panel($bundles[$entity_id] . '.' . $view_mode)) {
+        if (empty($panelizers[$entity_id][$view_mode]) && $this->is_panelized($bundles[$entity_id] . '.' . $view_mode)) {
           $defaults[$name] = $name;
         }
         // Otherwise unpack the loaded panelizer.

This part of the patch does not make sense to me. If there isn't a default (which is possible; if there is 'choice' and no 'default' then the default state is not panelized) we shouldn't be trying to load something. Please explain this change to me?

merlinofchaos’s picture

The above is particularly true because the reproduction instructions have you select "has default", so changing that test is very different from the reproduction instructions.

populist’s picture

Here is a more basic patch that just allows the selection box to be added.

populist’s picture

Status: Needs work » Needs review

I tested this new patch with the following conditions and it works fine:

1.) Create a content type that is Panelized with multiple options

2.) When creating node select an option and make sure the specified layout/content configuration exists

3.) Switch the option later (if the page isn't overriddeN0

merlinofchaos’s picture

Status: Needs review » Fixed

Committed and pushed #12.

There are some pieces of the original patch that seem like they might be legitimate bug fixes in other areas. These should not be lost, but I need more information about what they are fixing.

das-peter’s picture

I don't know what information I should deliver. I've wrote down what and why I did in each post. However, all the changes I made were based on assumptions I made about how panelizer works, not on qualified knowledge.
So, let me know how I can provide the information needed and I'll do so.

Status: Fixed » Closed (fixed)

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