Problem/Motivation

When i enable "Panelize this view mode", on node add/edit form panelizer field display all possible view modes.

Proposed resolution

Display only active(enabled) view modes for current bundle

Comments

gaydabura created an issue. See original summary.

gaydabura’s picture

StatusFileSize
new1.21 KB
gaydabura’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: panelizer_field_list-2912622-2.patch, failed testing. View results

gaydabura’s picture

StatusFileSize
new1.4 KB
damienmckenna’s picture

Issue tags: +Needs tests

This needs tests to confirm the change works as intended.

damienmckenna’s picture

This is also a duplicate of #2803089: Panelizer field should only show the enabled view modes, but it doesn't have a patch yet.

gaydabura’s picture

StatusFileSize
new5.33 KB

Updated code and tests.

gaydabura’s picture

Status: Needs work » Needs review
damienmckenna’s picture

Category: Support request » Bug report

damienmckenna’s picture

Status: Needs review » Fixed
Parent issue: » #2896009: Plan for Panelizer 8.x-4.1 release

Thanks for the fix! Committed.

Status: Fixed » Closed (fixed)

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

jkellendonk’s picture

This patch broke my site at edit time after updating panelizer to 4.1.0. For anyone who's getting notices like the following on panelized node edit pages, you may want to avoid pressing "save", or you may lose your custom overrides for a given view mode that you've entered by the IPE on a given node:

Notice: Undefined index: full in Drupal\panelizer\Plugin\Field\FieldWidget\PanelizerWidget->formElement() (line 112 of modules\contrib\panelizer\src\Plugin\Field\FieldWidget\PanelizerWidget.php). 

Warning: Invalid argument supplied for foreach() in Drupal\panelizer\Plugin\Field\FieldWidget\PanelizerWidget->formElement() (line 112 of modules\contrib\panelizer\src\Plugin\Field\FieldWidget\PanelizerWidget.php).

For me, the fix was to add "Full content" to the custom display settings on the content type display screen and to manually delete the rows in node__panelizer corresponding to displays that weren't enabled and clear cache. SQL I used, below, but be careful that you don't kill your website. :)

DELETE FROM node__panelizer WHERE bundle = 'page' AND panelizer_view_mode NOT IN ('default', 'full', 'header', 'teaser');