Closed (fixed)
Project:
Page Manager
Version:
8.x-4.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
13 Apr 2018 at 15:48 UTC
Updated:
26 Nov 2020 at 11:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
johnwebdev commentedI decided to start working on this. Still plenty of work to be done, but this is a start at least. Setting to NW to see if i broke something.
Comment #4
japerryEclipseGC and japerry have taken this a little further, but we'll need to redo a bit of this patch. We've started a branch in the mainline repo under this ID.
Main Todos:
* Saving doesn't work.
* Refactoring the storage classes so we don't hardcode it into the page variant.
* Profit?
Comment #5
andypostLink is not displayed in sidebar https://git.drupalcode.org/project/page_manager/tree/2960739
Ref https://www.drupal.org/node/2749491
Comment #6
shadcn commentedHey everyone, we are doing some work on this as part of #3051071: Switch to using Layout Builder rather than Panels/Panelizer. Here's a patch that fixes:
Main Todos:
* ✅
Saving doesn't work.* Refactoring the storage classes so we don't hardcode it into the page variant.
* Profit?
Note: this patch is from the
2960739branch.PS: Can we rename the branch to
2305199-layout-builderso that is shows up in sidebar. See #5.Comment #7
shadcn commentedLet's display some output.
Comment #8
dsnopekHere's a full patch against 8.x-4.x for easier review. The actual content should be the same as #7 - I basically just applied that patch in a local git clone of the feature branch, and then made the diff.
Comment #9
dsnopekI haven't tested yet, but here's some review just from skimming the code:
What's this @todo for? Can it be removed?
The file is called LayoutBuilderStorage and the class is PanelsStorage, so probably this isn't even used?
Always allowing access seems like it could be a problem :-)
A bunch of @todo's at the end
Comment #10
dsnopekI just did some manual testing and found a couple of things:
This is certainly starting to get there!
Comment #11
shadcn commentedI looked at the block issue today ( 2 and 3 from previous comment). I don't have a solution for it yet but layout builder is using
\Drupal\layout_builder\InlineBlockEntityOperations::handlePreSaveto handleinline_blockentities.I'll see if we can make this work with the page variant entity or try and come up with a custom solution.
Comment #12
johnwebdev commentedYeah, maybe parts of that can be moved to a public service in core, to enable easier integration for contribs. to handle inline blocks.
Comment #13
shadcn commentedOK a few more updates:
\Drupal\layout_builder\InlineBlockEntityOperationsPageManagertoPageManagerLayoutBuilderStorage. This matches the other LayoutBuilderStorage plugins and I think is a better name.LayoutBuilderStorageannotation.Ready for some feedback.
Comment #14
shadcn commentedI'll re-roll this.
Comment #15
shadcn commentedRe-rolled.
Comment #16
dsnopekThanks so much, @arshadcn!
I just did some testing, and inline blocks are now working, which is super awesome! This fixes #10.3, but I still experienced #10.1. I wonder if we need to attached some library somewhere in the add wizard so that the settings tray will work?
Looking at the patch code: it looks like #9.1, .2 and .3 are resolved! #9.4 which points out some
// @todoin the section storage plugin still applies to the latest patch, though. Do those methods need to be implemented? They're both deprecated, so maybe not? Although, they both make reference to storage initialization, so I wonder if maybe this is why the UI doesn't work when first creating variant in the add wizard?I think #10.1 and allowing adding sections and blocks during the initial "add" part of the wizard, is probably the biggest functional piece that needs to get fixed here.
Comment #17
anybodyThank you so much, this is a very promising feature request! Great work especially to @arshadcn & @dsnopek! THANKS!
I've just tried #15 and the selection "Layout Builder" in the "Type" select appears! Also the layout can be assigned and blocks can be put into regions. We LOVE it!
We found the following bugs (using Drupal 8.7.3 and Adminimal Theme (if that may have any impact)) with page_manager 4.x-dev:
BTW: You should perhaps have a look at #3035174: Rename SectionStorageTrait to SectionListTrait regarding SectionStorageTrait for the future which may have impact on this.
Thank yo so much, great work!
Comment #18
shadcn commentedOK new patch is ready for review. Here's a list of fixes.
❌I've been able to reproduce same with Block variants. So maybe a bug in page manager and not necessarily with layout builder?
✅This is all fixed now. Turns out that seven removes all contextual links for blocks. This affects adminimal as well since it uses seven as base theme. See #2487025: Remove contextual links in Seven. I added a fix to keep contextual links for layout builder blocks.
✅This is same as #10.1 and is now fixed.
Ready for another round of reviews @dsnopek @Anybody 👍
Comment #20
dsnopekWhen I apply the patch, clear caches and then just visit the site front page, I get a fatal exception:
I think the call to
seven_preprocess_block()needs to make sure we're actually in the seven theme (or a child theme of it) before making that call.If I access an admin page, then I don't get the fatal error, so I'll see if I can test the rest of the patch despite this first issue...
Comment #21
shadcn commentedYeah just noticed this as well. Fix incoming.
Comment #22
dsnopekI was able to test despite the
seven_preprocess_block()thing, and everything works as expected per #18! The main issue (#10.1) was fixed, along with all the issues pointed out in #17 except for the about aborting the variant, but since that's also present with "Block page" variants, I think that's fine for the scope of this issue.I skimmed the code, nothing new jumped out at me.
I think once the fatal error is handled, this will be ready for RTBC and maintainer review :-)
Comment #23
shadcn commentedFixed.
Comment #24
anybodyThis is great! Thank you, we'll also test this now!
Comment #25
dsnopekI just applied the interdiff from #23 and tried again. The fatal error is fixed!
I'm going to mark this as RTBC to try and attract the maintainers over to do some review. :-)
@Anybody: I'm looking forward to hearing how your testing goes as well!
Comment #26
anybodyThank you very much @arshadcn it works!!
The only thing that still doesn't work is the drag & drop for existing blocks, but perhaps it's because we're using adminimal theme? I'll have a closer look as soon as I find some time. I guess it might be a separate issue, but let's wait for further feedback. In the wizard it's working, but not on the final layout page.
Wonderful, I'm so happy about this, you are great!
Comment #27
dsnopekDrag & drop of blocks is working fine for me (I'm using the Seven theme). The adminmal theme could be related because there is the hack in there to workaround Seven: what if adminimal is doing something similar? Maybe we need a more generic hack that'll work regardless of which theme is messing things up?
Comment #28
manuel.adanReally amazing work done here, thank you all!. In a fresh D8.8 installation it works fine. Here some appreciations.
We introduce the logical dependency on the layout_builder module. Despite it is in core, it forces existing and new installations to enable it, even if it is not going to be used at all.
IMHO, this feature would be better to be provided by a submodule. It should not be hard to move into 'page_manager_layout_builder' or similar submodule name. It would be also convenient to isolate the layout builder related issues and its specific support that it requires, such as the builder storage.
The following exception occurs trying to access the page:
Comment #29
tim.plunkettAgreed on no dependency, but I don't think a submodule is necessary. PM can just provide extra code when LB is installed
The schema can stay even if LB doesn't exist, not harming anything
Agreed that this should be removed
These should have @todos pointing to #3005403: Cannot delete or edit a block that is placed in a section of the layout_builder in case that gets resolved
These could be added to a
hook_entity_type_build()that checks for LB (instead of a separate submodule)This plugin could be added via
hook_display_variant_plugin_alter()behind a moduleExists checkWhat's this annotation? Not coming from LB...
This can stay as-is since it won't be discovered unless LB is installed
Comment #30
shadcn commentedThanks everyone for testing and reviewing.
@tim.plunkett I've implemented the suggestions and removed the hard dependency on layout_builder. Thank you.
@Anybody Thanks. I installed adminimal but could not reproduce the drag and drop issue (see gif below).
@manuel.adan I'll add the tests now.
Comment #31
shadcn commentedRe-rolled.
Comment #32
shadcn commentedAdded JS tests.
Comment #34
johnwebdev commentedThe labels are different between 8.7.x and 8.8.x. I think we should use CSS selectors, or ensure compatibility with 8.7.x as it is the stable and target branch currently.
Comment #35
johnwebdev commentedGreat progress here, lovely too see! Here's a first review.
We are overriding all page variants to use the LayoutBuilderStorage which feels wrong. I think this is something was mentioned previously in the issue.
Maybe change to: Returns TRUE if Layout Builder module is enabled, otherwise FALSE.
We should have test coverage for this as well.
Maybe split this into multiple lines for better readability
for Layout Library => for Page Manager.
Missing a ending punctation
DefaultsEntityForm => LayoutBuilderForm
This indentation is not correct.
Comment #36
shadcn commentedFixed the tests and implemented suggestions from #35.
Comment #38
freelylw commentedafter apply the patch #36, I don't see there is a layout-builder variant in the variant-type drop-down selection ? or am I doing the wrong way ?
Comment #39
dsnopek@freelylw Do you have the layout_builder module enabled? This patch only adds a soft dependency, so it won't do anything if the layout_builder module isn't enabled. You may also need to clear caches
Comment #40
freelylw commented@dsnopek I enabled the layout_builder module already, and clear the caches as well, its a fresh drupal 8.7.2 installation. still no layout-builder variant showing.
Comment #41
shadcn commentedStill failing on
8.8.x. Let's try this again.Comment #43
freelylw commented#41 works in my drupal8.7.2
I can see we still missing 2 things then we will have something the same like when we were in drupal7 panel_page
1: there is no auto-drag for left/right of the section width, its a fix percentage at the moment, in reality, it doesn't work in this way.
2: why we don't have "Disable Drupal blocks/regions" on the page that we had in D7 version. at the moment, after you create a page, the default system block still showing .
Comment #44
dsnopek@freelylw: I'm glad it's working for you now! Please open new issues for those other things in #43 - this issue is just to allow Layout Builder to be used for Page Manager variants. Those would require changes in a bunch of other places that are outside the scope of this issue (ex. a new layout plugin for fully flexible column widths, a setting to swap in a DisplayVariant to hide the global blocks, etc).
Comment #45
johnwebdev commented#41 Failing test here is tricky, since it passes locally for me. Tried re-running to see if was random, but seemed to fail again :( Is anyone able to reproduce the failing test locally?
#35.1 Still needs to be addressed.
Comment #46
alexdmccabeThe patch seems to be working for me, although I haven't tried anything really complicated yet.
The tests are also passing for me locally, so I kicked off some new test runs just to see what happens.
I'm running PHP 7.2.16 in a docker container, tested using the run-tests.sh script.
Comment #47
alexdmccabeAnd now it looks like PHP 7 worked but has coding standards errors, whereas PHP 7.1 and 7.2 failed.
My bad for accidentally setting off the PHP 5.5 test, it's one of the defaults and I wasn't paying enough attention.
Comment #48
alexdmccabeChecking what fixing the new coding standards errors does to the PHP 7 test.
Comment #49
alexdmccabeTesting if waiting for the selectors to exist fixes the tests.
Comment #50
alexdmccabeOkay, trying
waitForElementVisible.Comment #51
alexdmccabeWell, after some further testing, it would also seem that contexts are not being passed into layout builder. For example, creating a layout builder variant of the default node view page does not allow you to place any node-related blocks on the page.
Even global contexts, such as the current user, don't seem to work - you can add and even preview them in the layout builder:
But when you try to view the page, you get an exception:
Comment #52
rajab natshahThis is so nice :) Thank you for the Patch
Seems that the patch is not applying for the latest stable version of Page manager.
Waiting for Drupal 8.8.0 to be out with the stable Layout Builder.
Comment #53
tim.plunkett#52, Layout Builder was stable in 8.7.0 (released in May 2019).
Comment #54
rajab natshahThank you Tim, Noted about that.
already working on
#3082049: Initialize [Varbase Layout Builder] with starter set of layouts and styling options for sections
But I have noticed that Drupal 8.8.0-beta1 do have an administration title for Section Configuration
It would be nice to have the layout builder variant with the page manager module out of the box. not sure about the administration title. or all will be synchronized in a blob in the database.
Comment #55
davidferlay commentedHi all,
Summarizing remaining todos from previous comments :
Some additional issues I found in testing patch #50 :
Screenshot here
Good news, selection criterias based on url path seem to work fine)
Comment #56
davidferlay commentedComment #57
jkevingz commentedMade some changes to the patch #50. In this new version, contexts should be passed to this new variant. Attached are some screenshots of contexts working.
Comment #58
andypostI bet this patch should not be included in this patch, please also provide interdiff of changes from previous patch to simplify review
Comment #59
jkevingz commentedSorry I didn't provide interdiff before. The only thing I did was to implement the ContextAwareVariantInterface in the variant and to create sample values for context during the preview.
One thing I noticed while using this new variant is that it doesn't allow changing the page title, but that's something I did't include in the patch.
Comment #60
YurkinPark commentedI found that layout_builder uses `context.repository` service to provide context. Still can not understand why/how node provides its context. This module does it always, even it can not :)
Comment #62
YurkinPark commentedFor some reason (localy at least) i found that apache doesn't process
/exampleroute well, changed this.Comment #64
johnwebdev commentedWe should probably update the issue summary, based on #55. It is quite unclear what remains to do here :)
Comment #65
YurkinPark commentedComment #66
YurkinPark commentedI've rolled back changes i made during patch attached in comment #60, and now i found a reason of wrong context provided during editing of layout builder context. I've realized also, that it is impossible to add entity config context to context list via UI since this issue https://www.drupal.org/project/ctools/issues/2696819
Comment #68
YurkinPark commentedReproduced tests non-working drag-and-drop but have not found a solution to fix it
Comment #69
YurkinPark commentedRealized that layout builder form (for adding new block) puts contexts taken from
context.repositoryservice. Replaced name of current_user context (not sure if it is good decision) but covered case when user can select wrong context for User entity view blockComment #71
andypostLooks the patch hit a wall on contexts which are not fixed in related #2511568: Create "context stack" service where available contexts can be registered
Comment #72
YurkinPark commentedbig interdiff because i've removed "patch.patch" (i think it was a mistake). @andypost problem is not in ctools context but in layoutbuilder creation form. As i mentioned in previous comment - it takes context list from
context.repository, but there is another machine name, so, i changed context name provided by page_manager also to don't duplicate it. Need to discuss this point.About panels_everywhere: i suggest to do it in issue opened under panels_everywhere project
Comment #73
YurkinPark commentedRerolled version
Comment #75
YurkinPark commentedSome fixes after re-rolling of patch
Comment #77
YurkinPark commentedHope it is last fix for current state. Next thing is to think about do we really need update of context name? If yes, we need update of current configs (to replace context name) and tests for it :)
Comment #78
anybodyThank you very much, YurkinPark, impressive work!
After updating to the latest .dev and applying patch #77 I get the following error:
TypeError: Argument 1 passed to Drupal\page_manager\EventSubscriber\CurrentUserContext::__construct() must be an instance of Drupal\Core\Plugin\Context\LazyContextRepository, instance of Drupal\Core\Session\AccountProxy given
Before we were working with beta4 + patch#31 successfully.
Comment #79
anybodyAdditional note:
We had to use the module "layout_builder_st" (based on core issue #2946333: Allow synced Layout override Translations: translating labels and inline blocks) in a different project and it seems that it crashes with this implementation.
Comment #80
YurkinPark commented@anybody , problem you have described in comment 78 can be resolved by clearing cache, because service definition is changed
Comment #81
anybody@YurkinPark, thank you - of course I did that prior to my comment but it didn't work... problem persists. But don't care too much about this, we've been using the early patches already and it's okay if in the worst case we have to recreate the pages when this is committed. I just wanted to leave the information here for you.
Comment #82
anybodyOk, news! :) I finally found out why a cache clear did not help for me. After applying the patch from #77 I had to update the page_manager page access condition the following way in
page_manager.page.my_page_xyz.yml:
New (working):
Before it was:
(See last line!)
which was generated by an older version of Drupal Core or Page Manager module.
We're using user_permission_condition module, but that wasn't changed in the meantime.
So maybe this is unrelated to the patch and simply appeared because with the patch I switched from 4.0-beta4 stable to 4.x-dev. After updating the yml (or re-saving the access conditions for that page in page manager -which was unaccessable due to that exception), everything works fine now.
Any ideas where to open that issue?
The ugly side-effect was, that every page showing a menu link to that page manager page also broke due to the missing context.
Comment #83
YurkinPark commentedYour notice is related to current patch for sure. I noticed in comment 77 that context name is changed because of layout builder (it provides exactly this context) thats why i decided to ask community for this change
Comment #84
anybodyAfter using #77 in many many projects successfully I can confirm RTBC. Of course I'd be happy about more feedback. Anyway its a great and large first step to this important feature.
Comment #85
YurkinPark commentedThis can not be released because there is no prepared updates. @Anybody you have case when you applied patch and your instance was down. hook_update will update existing instances to don't have WSOD.
Comment #86
anybodyWell but wasn't the reason here that I applied older patches on that sites before? Or did I get that wrong?
In that case I think an update path from patch to patch would be nice but optional?
Comment #87
andypostModule should not provide upgrades between patches but at least post update hook should be added to cause cache clear and rebuilding of plugins
would be great to add comment why that fires in this hook instead of alter
Sadly no way to exclude plugin other way
this changes looks unrelated
Why formstate needs to store whole entity?
I think form object already has page variant entity
empty array init is useless
Any reason getMock() used instead of prophecy?
Comment #88
Christopher Riley commentedDoes this patch correctly with beta 5 or is my system being stupid as I am getting errors when I try to patch manually and with composer it just fails.
Thanks,
Comment #89
YurkinPark commented@christopher-riley patch attached in comment #77 can be applied correctly. May be you have another patches in your list?
Comment #90
Christopher Riley commentedThat is what I was afraid of I am using the patch https://www.drupal.org/project/page_manager/issues/3124470 to correct the issue with selection criteria. Hopefully these will both get committed soon so I can avoid having to patch anything.
Comment #91
YurkinPark commentedNew version of patch contains all previous changes and post_update which allow you update all page_variants with new current_user context name and tests for post_update
Comment #93
japerryLets see if this fixes the testing issues...
Comment #95
japerryTHANK YOU everyone who has commented, committed, updated, etc to this long overdue patch. Lets get any bugs found into new issues. But for now, lets go with this patch.
FIXED.
Comment #96
anybodyThis is so GREAT news, thank you very very much @japerry! I'm really excited!
Comment #97
anybodyJust wanted to let you know that running the update leads to
on all our pages, but it works.
Comment #98
kyoder commentedWhile this patch (now merged into dev) integrates Layout Builder into the Page Manager UI, it doesn't appear to provide for in-place editing (on the page itself) and there is no Layout tab (as found if a content type has Layout Builder enabled).
Am I missing some way for a user to edit the page content and layout without having access to the administration side of the UI?
Comment #100
japerry@Anybody: ahh we probably should check to see if any criteria are selected. Pushed a followup commit to fix the notice.
@kyoder: you'll need to setup a new variant of type 'Layout Builder' to see the UI in Page Manager.
Comment #101
kyoder commentedHey japerry thanks for responding.
I've added a "Layout Builder" variant and while that provides the layout UI, it's only on the administration side.
If I visit the created page there is no "Layout" tab as can be found when a regular node page is created with Layout Builder enabled for it.
My use case would be user 1 creates a site homepage via Page Manager with the Layout Builder variant.
Lower admin users should be able to add content to this page in the sections but not have access to the Page Manager administration UI.
Comment #102
japerry@kyoder, that is by design... for now. Page manager has no IPE feature. It would have to be created as a totally separate ticket.
Comment #104
nwom commentedAwesome work everyone! Just for reference though, using the Layout Builder variant still doesn't work with Panels Everywhere as discussed here: #3143487: Not compatible with "Layout Builder" variant as site template (Workaround found)