When you are using Panelizer a lot on a site, you end up with many, many different sets of "Allowed Content" and "Allowed Layouts". In a properly Panelizer site, you will have one set for panel pages, one set for each node type, one set for each taxonomy, and one set for each user. That is a lot!
However, in most cases, you don't want/need that level of granularity. It is totally fine in most of my sites to have the same set of layouts and the same set of content types across the entire site. This can currently be achieved in Panelizer, but it requires a lot of clicking/syncing.
As a possible enhancement, when I was working on #1822136: "Select Allowed Layout" option in Panelizer is not respected in IPE. Page Manager defaults are used instead. it realized it might be possible to define a "default" option which could be set up in the Panelizer UI so that you could just use the standard Panels_pages set of content/layout instead of defining your own.
Comments
Comment #1
populist commentedHere is a patch which subsumes the work in #1822136: "Select Allowed Layout" option in Panelizer is not respected in IPE. Page Manager defaults are used instead., but it provides the following things:
1.) It adds an option to the Panelizer "Allowed Content" screen to let the user decide if that bundle will use "Default" content types and layouts. The default here is OFF as to not break existing implementations and to make this optional functionality.
2.) It hooks into panelizer_panels_cache_get() to only set "custom" content types and layouts if the default is OFF. If the user has chosen it to be on, it just uses the global settings.
A few things that are probably still needed:
1.) I only tested this with the IPE and its possible the backend uses a different method of determing allowed content and layout sets.
2.) I think the language needs to be cleaned up a bit to be clearer to the end user so they know what they are selecting when they say defualt
3.) The interface might need some work since adding a checkbox to the vertical tabs may not be ideal. However, since #1148950: Applying #states to a vertical tab does not update the vertical tabs menu is not yet fixed we cannot do something fancy like #states and I don't know if making a custom UI just for this little tweak is required.
Comment #2
populist commentedHere is an update to the patch to separate out the options for default content and default layout. This now exposes both in the Panelizer settings:
Comment #3
merlinofchaos commentedI think my only issue with this patch is that if checked, there needs to be a really solid way of making it clear that the rest of the checkboxes aren't actually active. Potentially states can do that, but I don't quite know how to make that interact off the top of my head.
Comment #4
populist commentedHere is a re-roll of #4 based on the feedback in #3. Adding a #states element is probably not possible right now due to #1148950: Applying #states to a vertical tab does not update the vertical tabs menu, #994360: #states cannot check/uncheck checkboxes elements, but this patch will properly set the disabled properties of the layout or content elements (using the same logic as panels_common_settings does) depending on those values. You will need to do a page reload if you change the setting, but I think that is intuitive enough for this uncommonly used page.
Comment #5
populist commentedThe patch in #4 also will need, in certain cases, to include the relevant Panels layout code - ctools_include('display-layout', 'panels'). There is a problem with backend Panelizer interface when it doesn't include all the layout code and currently dies as per #1828684: Fatal error: Call to undefined function panels_get_layouts()
Comment #6
populist commentedMoving this back to needs review since the trouble we were seeing was independent and fixed with this patch #1828684: Fatal error: Call to undefined function panels_get_layouts()
Comment #7
populist commentedHere is a quick re-roll to work against the latest dev.
Comment #8
beeradb commentedJust spent quite a while with this patch and things look fairly good to me.
I was able to toggle between default / custom layout and content options and see applicable options change as expected.
Additionally, I did some testing around what happens if you have content (or a layout) for a specific node which is no longer allowed. In these cases panelizer handles the save just fine and will retain the content . This seems like the most correct way to handle that situation.
Anyway, +1 from me.
Comment #9
merlinofchaos commentedCommitted and pushed.
Comment #10
ericras commentedThis is a nice feature but I was confused because turning it on or off doesn't have an effect without clearing the ctools_object_cache table. I see from #945310: ctools_object_cache table not rebuilding that this table is supposed to be left alone but without emptying it I have to wait for an indeterminate time for it to clear itself. (Running cron/clearing cache doesn't have an effect.)
It would also be helpful if "Use the same allowed ... as standard Panels pages" was linked to admin/structure/panels/settings/panel-page