Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Similar to #2767087: Provide hook to alter available blocks for IPE, provide a hook to customize the list of layouts available to IPE.
Comment | File | Size | Author |
---|---|---|---|
#17 | interdiff.txt | 1.47 KB | dsnopek |
#17 | panels-hook-layouts-alter-2849219-17.patch | 1.54 KB | dsnopek |
| |||
#14 | panels-n2849219-9-reroll-4.1.patch | 1.38 KB | hideaway |
| |||
#8 | panels-n2849219-8.patch | 2.28 KB | hideaway |
| |||
#6 | panels-n2849219-6.interdiff.txt | 724 bytes | DamienMcKenna |
Comments
Comment #2
DamienMcKennaThis mirrors hook_panels_ipe_blocks_alter().
Comment #3
tim.plunkettHm, so I envision that every different implementation of layouts will want a hook like this. But that would only make sense if you alter the definitions directly, not this meta version.
Also I could see adding a method to LayoutPluginManager that would be like
->getDefintionsForUseCase($use_case)
(but a better name) where you would pass in "panels_ipe" and it would be passed along to an alter hook or event. (That should not block this IMO)Comment #4
DamienMcKennaComment #5
japerryComment #6
DamienMcKennaThis reindexes the blocks after they're altered, per #2767087.
Comment #7
dsnopekIt'd be really great if some of the context in which the IPE was being used was passed to this alter hook. Using even just the
PanelsDisplayVariant
it's possible to learn a lot! For example, you can include some Panelizer specific code in your alter hook to see what content type is currently being edited.Comment #8
hideaway CreditAttribution: hideaway commentedPatch has a small error most likely due to copy-paste from similar issue :)
this:
should be:
Comment #9
DamienMcKenna*cleans his glasses again*
Thanks @hideaway.
Comment #10
DamienMcKennaTo tim.plunkett's point: #2858162: Allow each type of plugin to be filtered per display subsystem
Comment #11
DamienMcKennaTalking through this some more with tim.plunkett, is this still really needed? The layouts provided by core could be intentionally kept somewhat limited to make them usable universally, while people building custom layouts for their own sites or to bundle with their themes could just use a category name that mentions its intended use, e.g. "Full page; Columns: 2" for layouts intended for a full page which has two columns.
Comment #12
Chris Burge CreditAttribution: Chris Burge commented@DamienMcKenna - Would this cover a use case where a site builder writes 2 or 3 custom layouts and wants to restrict users to only those layouts?
Comment #13
DamienMcKenna@Chris Burge: Yes, that's the exact scenario I was working from.
Comment #14
hideaway CreditAttribution: hideaway commentedversion 4.1 reroll
Comment #16
Chris Burge CreditAttribution: Chris Burge commentedUpdating version to 8.x-4.x-dev
Comment #17
dsnopekPer my comment in #7, here's a new patch that also passes the
PanelsDisplayVariant
. This could allow you to, for example, change the layouts differently for two particular Panelizer content types.These are the same changes as in #2886230: hook_panels_ipe_blocks_alter() should receive the PanelsDisplayVariant being editted for
hook_panels_ipe_blocks_alter()
Comment #18
DamienMcKennaThanks for the improvement @dsnopek.
Lets do this thing and go home.
Comment #20
samuel.mortensonCommitted! The review in #3 was never really addressed but I feel like that could be a core issue about plugins in general.