In D7 Page Manager (actually, the "Panels" variant) it was possible to disable the Drupal blocks/regions used on a page when viewing a particular Page Manager page. This was useful if there were some blocks configured to show up in the sidebar on all pages, but you wanted to hide them so your Page Manager page could take up the full width of the page.
Yes, we'll need to implement this in Panels' DisplayVariant as well! But since Page Manager is providing a variant to show blocks, this does kinda make sense here too. Although, I'd be open to arguments about why we should do this only in Panels instead. :-) Please let me know what you think!
Implementation ideas
- The checkbox will need to be added to the edit form. In D7, the title was "Disable Drupal blocks/regions" and the description was "Check this to have the page disable all regions displayed in the theme. Note that some themes support this setting better than others. If in doubt, try with stock themes to see.". This probably belongs in:
src/Plugin/DisplayVariant/BlockDisplayVariant.php and it's buildConfigurationForm()
- Page Manager needs to be able to find pages where there is a variant selected that has this set... I'm really not sure how to do this. In D7, it uses the "task" system, that I don't entirely understand. @tim.plunkett: Do you have any ideas?
\Drupal\page_manager\EventSubscriber\BlockPageDisplayVariantSubscriber::onSelectPageDisplayVariant (in the current patch on this issue) needs to check if the current variant from Page Manager has this option enabled.
Comments
Comment #1
dsnopekI made an attempt at some ideas for how to implement in the issue summary...
Comment #2
dsnopekComment #3
dsnopekComment #4
tim.plunkettNeeds a UI toggle, and \Drupal\page_manager\EventSubscriber\BlockPageDisplayVariantSubscriber::onSelectPageDisplayVariant needs to check it.
But this works just for now.
Comment #5
dsnopekThanks, Tim! I didn't know about the "simple_page" variant. I've updated the issue summary.
Two things:
Thanks again!
Comment #6
tim.plunkettBy the way, if these pass, we need tests to prove they shouldn't.
#5.1 Yes, we should.
#5.2 Not sure yet, still thinking on it.
Comment #7
tim.plunkettRight now the only thing in core that uses ThirdPartySettings are config entities, so I tacked this onto Page via that.
However, instead of a nice snippet like
$variant->setThirdPartySetting('page_manager', 'no_blocks', TRUE);we're stuck with
in order to key it by the variant.
It also made for some exceedingly confusing config schema wrangling, but I figured it out...
This still needs a ton of tests. That can wait until tomorrow.
Comment #9
tim.plunkettIt's "tomorrow"!
Still want to look into moving the settings down a level.
I pushed some commits that weren't necessarily about this feature while working on it:
Still needs some web tests IMO.
Comment #11
tim.plunkettThat interdiff was wrong, sorry. Here's one from #7.
And that last bug is silly, getThirdPartySettings vs getThirdPartySetting
Comment #12
wim leersFYI: related D8 docs: https://www.drupal.org/developing/api/8/render/pipeline
Comment #13
wim leersAll of the wording is block-specific. But really, if there's also a
PonycornPageVariant, this would override that too.Note that if you really want this to override anything else, then you'll also want to call
$event->stopPropagation().Exactly the opposite, actually :)
Oopsie :)
Comment #14
RKopacz commentedWhatever happened to this feature. Has it been added? I am playing with 8.x-1.0-alpha24 , and do not see it anywhere, and would like to have this feature available. Has it been dropped?
Comment #15
tim.plunkettIf the feature was present then it wouldn't need a feature request. It still needs work.
Comment #16
gambryA lot have changed in page_manager since #11, so I tried to keep its ideas while using the new classes interfaces and models.
I've excluded the tests as I first want to be sure my approach is correct. Specifically:
Comment #18
gambryBeen lazy and thought I could get away without updating the schema.
This comes green locally.
Comment #19
gambryComment #20
damienmckennaMinor complaint, but I don't like the setting name "force_simplepage".
Something to consider - might there be other display plugins which could be listed? In other words, might it be better to make this a selector to e.g. choose between "Normal page (default)" and "Hide other blocks on the page", so that maybe there could be extended beyond these two, or would that be over-engineering it?
Comment #21
gambry@DamienMcKenna I agree is terrible name, but due #13.1 I couldn't find anything better.
My original idea was to use the 'This variant owns the page, so no other/external blocks, regions, content will be displayed" naming convention, which covers #13.1 and still mention the old reference to blocks and regions. But I couldn't find a shorter key-name version. :p
I'll try to get hold of @Wim Leers at DDD.
Comment #22
gambry@Wim Leers mentioned at least another module is using
RenderEvents::SELECT_PAGE_DISPLAY_VARIANTevent: RefreshLess.The idea of the dropdown is a good one. I'll work on it, together with:
Use dependency injection.
This should have a comma at the end.
Comment #23
japerryPage Manager 8.x-1.x is no longer supported, closing.