Closed (fixed)
Project:
Panels
Version:
8.x-4.x-dev
Component:
API
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 May 2017 at 14:49 UTC
Updated:
16 Jun 2017 at 15:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
phenaproximaHere is a patch implementing one possible approach (PanelsStorageBase implements a save() method which fires the event). Needs tests, but I'd rather get buy-in from the maintainers before doing that.
Comment #4
phenaproximaThis should fix the broken tests. I also asserted that the event is dispatched, so maybe this doesn't need tests anymore. Optimistically removing the tag.
Comment #5
tim.plunkettLooks good, follows the naming and docs conventions of core.
This is the part that worries me. Like this code, Panelizer doesn't call
parent::save.IMO, the actual event dispatching should happen in
\Drupal\panels\Storage\PanelsStorageManager::save(). The way the code reads, that should be the only thing ever calling ::save() on PanelsStorageGood looking out, since without this Panelizer would break.
Couldn't be more straightforward
*eyeroll for formatting change*
Yayyyy
Comment #6
phenaproximaReplying to #5:
No interdiff this time because it is a rare case where the interdiff is longer than the patch, due to the number of things I ripped out :)
Comment #7
phenaproximaThis is blocking inline block support for Panels: #2883154: Support inline blocks in Panels display variants.
Comment #8
tim.plunkettout of scope now
Is there any reason to move the event before the actual save call? Maybe if an event subscriber wanted to throw an exception or modify the thing before it is saved...
Also this makes me think it should be named VARIANT_PRE_SAVE or VARIANT_POST_SAVE to indicate which is happening.
This test does a lot of specific things to set up a valid $page and $variant, but the only assertion is on
Argument::type(PanelsVariantEvent::class)To follow-up my earlier point of when the event is actually fired, I think a clearer test would be to do something like
And then check that the variant was disabled afterwards
Not gonna highlight them all, but also out of scope now
Comment #9
phenaproximaAll fixed! I added pre-save and post-save events, for convenience and consistency.
Comment #10
phenaproximaMade additional changes requested by @tim.plunkett on Slack, and made the test a little more useful.
Comment #11
tim.plunkettThat test looks great! If it passes, this is good to go.
Comment #13
japerryLooks good. Committed.