Problem/Motivation
Mini panels in Drupal 7 allows you to arrange content panes with provided context and additional context in a layout. This is really handy functionality for building complex layouts or re-usable components. This would be a great addition to Drupal 8 as well.
Proposed resolution
Implement more/less a straight functional port to Drupal 8 with the addition of allowing variants on a mini panel. Structurally, we have found that it is very similar to Page Manager in both code and UI with the main exception that Page Manager is based on paths for it’s provided context rather than passed in context. Therefore we think we should abstract and share this code rather than duplicate it.
Remaining tasks
- Decide what module it should reside in (or it’s own)
- #2682449: Create mini panels config entities (including abstracting code shared with page manager)
- ...
User interface changes
New UIs for editing mini panels which will very closely correspond with the Page Manager UIs.
API changes
Abstracting aspects of Page Manager that are common to both Page Manager and Mini Panels. This includes various classes and UIs.
Data model changes
Share common data elements between Page Manager and Mini Panels.
Comment | File | Size | Author |
---|---|---|---|
#18 | field_layout-with-blocks2.png | 67.02 KB | DamienMcKenna |
#18 | field_layout-with-blocks1.png | 50.88 KB | DamienMcKenna |
#13 | layout_d8.jpeg | 417.59 KB | bcobin |
Comments
Comment #2
andrewbelcher CreditAttribution: andrewbelcher at FreelyGive commentedOn the name/where it should live front - I think in Drupal 8, we are not going to be as closely coupled with Panels, but rather allow other
\Drupal\Core\Display\Annotation\DisplayVariant
s to be used. This leads towards wondering if we should both separate it from Panels by name and location. We’ve tried to think up a few different names, but haven’t really liked any!In terms of location, I am thinking CTools may be the best location for the abstracted parts and possible also the ‘mini panel’ module...
Comment #3
geek-merlinComment #4
cmwelding CreditAttribution: cmwelding commentedYou can achieve Mini Panels functionality to create a block of blocks in Drupal 8 without using Panels module.
Required modules: Display Suite, (Bootstrap Layouts recommended for responsive layouts)
-Create your custom individual blocks
-Go to Structure -> Display Suite -> Fields and create block field with block content as entity and select the newly created block. Create a new block field for every block to be inserted.
-Create new block type. No additional fields needed unless required.
-Go to manage display and select a bootstrap or DS layout
-You can select custom display settings and have multiple view modes if required
-The Block Fields created in DS will be visible under disabled region
-Move DS Block fields to desired regions and save.
-Go to Custom Blocks library and add a custom block using the newly created block type and save.
-Your new block is ready to be placed in desired region.
-Note that one block can be added multiple times in D8, each with different view modes if multiple view modes selected.
Comment #5
dobrzyns CreditAttribution: dobrzyns commented@cmwelding Best practice is to use only one layout method. That is, Panels or Display Suite. Though using Display Suite is a work around, it's not a long term or best practice solution.
Comment #6
DamienMcKennaComment #7
zptoth CreditAttribution: zptoth commentedHi, any update on this?
Trying to place panels into a block in Drupal 8 but cannot figure out any straightforward way without mini panels.
Thanks,
Comment #8
zptoth CreditAttribution: zptoth commented-
Comment #9
bcobin CreditAttribution: bcobin commentedI've been trying non-stop for two days now to create a three-panel block like I used to do in D7 with mini panels - without success.
I don't want to create a page.
I just want to create a block.
A block with three regions where I can insert blocks or other content, just like I can do with mini panels in D7. I want to be able to add classes to each region, just like I can do with mini panels in D7. (Titles, etc. would be nice, too.)
@dobrzyns says that Display Suite is not a best practice solution... OK, well then what is? I see no provision to add regions in blocks, so I am completely stumped as to how this is done in D8. All the documentation I find references constructing an entire page.
But I don't want to create a page.
I just want to create a block.
I can't use Drupal 8 on account of this - and it's now been around two years that I've been waiting for a D8 version of mini panels. It's hard to believe that something so straightforward can't be done - I must be missing something, but I have no idea what it might be.
Any ideas? A step-by-step guide would be really nice, and I'm sure it would be really appreciated by the other 24 people that are following this... hope someone can help! Thanks in advance...
Comment #10
DamienMcKennaYou should be able to enable Layout Builder for block types (on the "manage display" page) and then customize the display as needed.
Comment #11
bcobin CreditAttribution: bcobin commentedThanks for the quick response, Damien. But I don't see it. Here's what I'm doing:
1: Go to /admin/structure/block/block-content/types
2: Add custom block - call it Three-panel block and Save
3: Edit block type - admin/structure/block/block-content/manage/three_panel_block > Manage display
All I see is the default Body field. There's no provision to add regions.
DITW. (Dead in the water.)
Comment #12
DamienMcKennaSteps:
Strictly speaking you could probably do this with Field Layout too.
Comment #13
bcobin CreditAttribution: bcobin commentedThanks, Damien - so I need to ignore the warning about experimental modules and that they shouldn't be used in production environments, I suppose.
Anyway, see attached for what happens when I select a three-column layout.
This is some progress, though... thanks!
Comment #14
DamienMcKennaYeah, that's it!
As mentioned, the Field Layout might also work. It lets you structure content display using predefined layouts.
Comment #15
bcobin CreditAttribution: bcobin commentedHuh? Did you see the image? It's unusable. Just take a look at the right column.
Thanks for the response, Damien, but to be clear, although this may be going in the right direction, it still doesn't work and is not a solution. And that's not even addressing the "experimental" issue.
As far as Field Layout is concerned, I don't see where that would be invoked and, besides, I need regions to place blocks (or other content in), not field formatting.
I can't believe that the functionality of mini panels is impossible in D8 - that seems like an astounding oversight. And if it hasn't been addressed by now, I think it's quite possible that it never will be. Wow. Anyway, it is a show-stopper for me - somebody prove me wrong! Thanks...
Comment #16
DamienMcKennaOne problem with Layout Builder is that it uses the frontend theme rather than the admin theme, which might not work well with your theme. It works ok with the default Bartik theme, but YMMV with contrib or custom themes, and remember that bugs with contrib themes/modules can be fixed via their respective issue queue(s).
FYI Field Layout uses the admin theme so wouldn't have these problems.
Comment #17
bcobin CreditAttribution: bcobin commentedChanging the theme doesn't make a difference for Layout Builder - as per the screenshot, it's still unusable. I'm pretty good with CSS, but I don't know where to start here - I have no idea what it's supposed to look like. But I can't imagine it's supposed to look like this. This is a vanilla installation, so there's nothing weird going on.
And I don't see where/how Field Layout would be applicable.
So... thanks for the responses, Damien, but this is still looking like a major D8 fail over here. Ugh.
Comment #18
DamienMcKennaField Layout covers what you need - select a layout:
Then move the fields to the appropriate regions:
The problem you might face is that you cannot use Field Layouts at the same time as Layout Builder - LB disables FL for entity displays, leaving it only available for entity edit forms.
Comment #19
bcobin CreditAttribution: bcobin commentedOK - so I've managed to create a three column block. Now to populate it.
I've created three basic blocks - I think. The reason I say "I think" is because when creating a block, display region is a required field. There is no provision for not displaying the block anywhere. That's dreadful, but let's skip that for now - the blocks do at least appear on the Custom Block Library page.
Now, in my three-column block, the fields to add content are autocomplete, so if you don't remember the exact name of the block, you're in trouble. There's nothing like the GUI in D7 where you're able to see the different options.
So I enter the name of one of the custom blocks I created and... nothing. AFAICT, there's no way to add the blocks I created.
So, once again, I'm dead in the water.
I so don't mean to be a pain here, and I really appreciate the help, Damien, but I'm still amazed how difficult it is to do something so straightforward that I can do it in my sleep in D7 - in fact, it's still not clear to me that it's even possible at all in D8.
Wow...
Comment #20
DamienMcKennaOh, you're trying to embed other blocks inside this 3 column block? What sort of content is in them? Could you restructure it so that the actual content is inside the 3 column block instead of being referenced?
Comment #21
bcobin CreditAttribution: bcobin commentedI do a lot of political sites and the content can vary - sometimes it's a view, sometimes a linkable graphic, sometimes a (large) video thumbnail - it can be anything.
Content changes all the time, as does order, so the ability to pop one pane out and pop a different one and/or reorder the panes is something I do all the time.
It's a breeze with mini panels - can this not be done in D8?
Thanks for taking the time, Damien - I really do appreciate it, but I'm getting a sinking feeling that I'll be stuck on D7 for a while still... :(
Comment #22
DamienMcKennaYou're welcome. I'm also trying to work out what scenarios are possible on D8 and have found some others which are also harder to do on D8 than they were on D7.
Something to consider is to use Inline Entity Form to make the reference fields easier to use, so you have something better than an autocomplete field.
Comment #23
manuel.adanFrom a project I'm working on, I just created a new project that is pretty similar to what Mini Panels is. I named it Page Sections, since it depends on Page Manager and Panels. It just defines a new page variant that is available as a block.
An initial implementation is available at:
https://www.drupal.org/project/page_sections
Any feedback is welcome.
Comment #24
rlmumfordThis module allows you to put layout_builder layouts in blocks.
https://www.drupal.org/project/mini_layouts