Closed (fixed)
Project:
Drupal core
Version:
9.1.x-dev
Component:
layout_builder.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 May 2020 at 18:13 UTC
Updated:
10 Sep 2023 at 11:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
b_sharpe commentedNot sure if this warrants tests as functionality should not have changed. Please review.
NOTE: If using layout_builder_st (or any other module that overrides the LB Element class) then you will get an error since it is expecting different construct.
Comment #3
b_sharpe commentedUpdated patch to allow BC for contrib as it seems there are a fair amount of known modules overriding the LB element due to the lack of being able to decorate plugins.
Comment #4
b_sharpe commentedUpdated remaining tasks
Comment #5
mahmoud-zayed commented+1
Comment #6
tim.plunkettLooking good! Next up would be a test implementation of an event subscriber, maybe a couple or one with dynamic behavior. Run before core's, after, and one before that stops propagation.
Comment #7
b_sharpe commentedAdded tests for before/after default event as well as stopping event propagation.
Comment #8
tim.plunkettTests look good!
This should be something like this
Then in 10.0, it'd get the typehint.
For example, see this evolution over 3 releases:
https://git.drupalcode.org/project/drupal/-/blob/8.6.x/core/modules/cont...
https://git.drupalcode.org/project/drupal/-/blob/8.7.x/core/modules/cont...
https://git.drupalcode.org/project/drupal/-/blob/9.0.x/core/modules/cont...
Then this could drop the NULLs
I think this should set a specific priority higher than 0, since this is our expected behavior. Then any 0 (default) priority subscribers will consistently after this one, unless they purposefully specify
Great! (Though very odd that it is a string, not an int, not what I expected 😅)
Comment #9
b_sharpe commentedComment #12
b_sharpe commentedWhoops, I accidentally reverted the test change before patch. Let's try this again.
Comment #14
tim.plunkettAll of the implementation and tests look great, into the home stretch which means very nitpicky coding standards fixes :)
The event dispatcher.
Lower case
null(optional) The messenger service. This is no longer used and will be removed in drupal:10.0.0.
I believe these need a link to a change record. See other trigger_errors in core.
This NULL can be removed
"when during" in the first docblock
"LayoutBuilder Element" should be
\Drupal\layout_builder\Element\LayoutBuilderto not be ambiguous. That can also be added to the @seeThe capitalization on preRender() is inconsistent, as are the parens
Also while it is a method name, it's only coincidentally the same. I think this should be
#pre_renderin all cases, as that's where it's actually run.This seems copy/pasted
The section storage plugin.
Constructs a new _____.
And make sure it's the right class name
Not any more!
More preRender
spell out Layout Builder
Comment #15
deepak goyal commentedComment #16
b_sharpe commented8.9.x changes here, will post 9.1.x if all looks good.
Comment #17
deepak goyal commentedHi @tim.plunkett
updated patch please review.
Comment #19
deepak goyal commentedComment #20
WebbehWith the repeat of work between #16 and #17, and #16 passing automated testing while #17 fails, marking Needs Review with work of #16.
Comment #21
b_sharpe commentedAssigning to me to not muddy waters here...
I will repost a proper 9.1.x and a backport for original 8.9.x
Comment #22
b_sharpe commentedSummary of changes to keep things in order here:
Comment #24
tim.plunkettOne more pass on the nits should do it.
Also it occurs to me that this is supposed to test the deprecation. You can pass in the things that aren't supposed to be passed anymore, make sure it still all works, and use
@expectedDeprecationon that test method.The CR link should be in both
Missed one
no U in collaborate, and missed a #pre_render. Also didn't make the change about not calling LayoutBuilder Element.
Not sure what this is supposed to be :D
Comment #25
pyrello commentedVery nice work on this update. I think this is going to be a big improvement to the LB system.
I wanted to note that the event, as currently designed, only allows for alterations to the sections and components. The administrative links, such as "Add block" or "Add section" get added after this fires, so it is still necessary to use a '#pre_render' function to alter behavior related to that.
Comment #26
b_sharpe commentedComment #28
tim.plunkettThis is a welcome addition, it has great test coverage, and to the best of my knowledge is up to par with how deprecations should be done. Great work @b_sharpe!
Comment #30
tim.plunkettRandom fail in CKEditorIntegrationTest. Requeued/reRTBC'd
Comment #32
tim.plunkettBroken by #3055198: [Symfony 5] Symfony/Component/EventDispatcher/Event is deprecated in Symfony 4.3 use Symfony/Contracts/EventDispatcher/Event instead, see https://www.drupal.org/node/3159012
tl;dr the arguments to ::dispatch() need to be swapped
Comment #33
b_sharpe commentedUpdate per change record.
Comment #35
tim.plunkettThanks!
Comment #36
alexpottCan use a return typehint in new code.
typo Chack
typo: get's
Comment #37
b_sharpe commentedfixes from last comment.
Comment #38
tim.plunkettIt was news to me that the policy is to add strict return types to code now, and that's not in the coding standards yet.
But as @alexpott clarified on slack, it's much easier to add them now than later...
Also I don't understand cspell, is that not integrated with testbot?
Either way, the patch is good.
Comment #40
alexpottI'm sorry on my last review I missed that we don't have a change record describing the new event and when to use it. Once the change record exists this issue can be set back to rtbc.
Comment #41
b_sharpe commentedAdded https://www.drupal.org/node/3160587
Comment #42
tim.plunkettper #40
Comment #43
alexpottCommitted e77ca8b and pushed to 9.1.x. Thanks!
Comment #45
vselivanovPatch from #26 works with Drupal 8.9.2.
Comment #47
quietone commentedPublished change record