One of my favorite parts about this blog series, Learning through Trial and Error, is the ability to just poke around Drupal 8 and see what is new. I decided it was time to give the block system another go without any helper modules in place. Wow, blocks are now a contender in Drupal 8! Before we take a video tour of the new block system, here is a list of new things I have discovered:
- Custom blocks, and blocks in general, can be used more than once
- A block title is now an on/off check box instead of having to use <none>
- The UI is easier to use with new blocks now in a sidebar instead of at the bottom
- This sidebar UI allows for dynamic filtering to make it even easier to find a block
- Configurations of block types and layout are now in code!!!
- Permissions are still very limited
- Site builders will still probably want something like Context in D8
One of the biggest changes you'll see is a a new tab in the block configuration page for "Custom block library." This library is used to display all your custom blocks that were created via the blocks module. It contains two sub-tabs: "Types" and "Blocks." Types is like content types for blocks. You can define standard kinds of blocks and each block type can have its own fields attached—even images. The fields on your block types use the new form and view modes, which gives you a lot of flexibility in terms of how your block fields are displayed. You can set view modes per block location, which means you could have a block with an image field, and that one image field will display differently depending on the location of the block.
Here's a sneak peak of the new block layout UI:
Take a look at the video to get a tour of the new block system, I am getting really excited because if things like the block system got this kind of attention, Drupal 8 is gonna be a great CMS and one to look out for.
Comments
Great and very neat demoing, Kyle. And it's certainly not only you who's getting super exited! One dog there, one dog here.. :) Thanks.
Thanks for the tour of Blocks in Drupal 8. Like always, your teams' operations are a ace in the hold.
What are your thoughts on the blocks + context versus panels everywhere debate?
I don't really feel it is much of a debate. I feel they both have different purposes with some-what of a similar outcome. For some panels is overkill, for others context/blocks is too limiting. Panels sometimes gets a bad rap because of the code bloat, but it can do some really powerful stuff once you dig in. But that power has use cases, so if your site needs panels, you will know it. That is not necessarily the "panels everywhere" concept though. I have played around with the panopoly distribution and it is very cool, but again has it's own use cases. So basically, use what works with your current needs and you will be better off.
Thank you for the well-written response. Do you believe that performance-wise, it's a draw?
If panels is used responsibly, then yes a draw. Panels has some heavy caching abilities. With that said, it can certainly be taxing if caching is not possible or setup incorrectly. In reality, there is alot more you can do with Panels than with Context and Blocks alone.
It's worth mentioning that the slowest thing about panels is actually views. If you toss a bunch of uncached views into a single panel, then you're going to incur some penalties. Always keep that in mind, and plan accordingly.
I personally NEVER use context for block placement, and would argue against it in practically all cases. A panels-everywhere approach is far superior, and while we didn't get D8 to that point, I think that, just as there were a lot of improvements in the block system that is going to ship in 8.0.0 we could go further and do more and I intend to continue to push on that in future releases.
That said, thanks for the kind words on this Kyle, a lot of people put in a lot of time and it's encouraging to see it come together as much as it has.
Eclipse
Nicely written - it is now 2018 and the "Context" module is still not in production.
How does that affect the recommendation for Context/blocks v.s., Panels?
Hi twagner,
The blocks and layout systems in Drupal 8 are quite a bit more robust than they were in Drupal 7 (and even than when this article was published). I'd recommend first trying to rely strictly on Drupal core, and only looking for another solution after the need arises and the functionality provided by core is found lacking by your requirements.
Cheers,
Blake Hall
Hi, I would like to know. What do you use to manage some page.
In drupal 7, I use panels with ctools and then variant but in Drupal 8, I don't found so much solution to have a simple way to manage this...
Because you don't go to add all your block into the same page with condition... That's gonna be unmanageable.
Thx for your answers.
The contributed module ecosphere for Drupal 8 is still a work-in-progress, but I think it's safe to say that our favorite D7 solutions like panels, context, page manager, etc. will all get ported to Drupal 8. Once Drupal 8 is completed though I'm sure this will all shake out.
I didn't have time to watch the video, but wanted to point out a minor change that took me a while to figure out. When assigning a block to specific pages, you need a leading slash now.
Hi,
Can we use the insert block module for drupal 8 to place blocks anywhere within your node. I am trying to use it in the same way as I did in Drupal 7 (installed and enable the insert block module and added the [block:block=1] code into my node) however, the block is not displayed inside the node. I would really appreciate some help in this context.
Regard
Hi Emal,
It looks like the insert_block module is still in development and isn't yet working with Drupal 8.
You can track the progress of the project in it's issue queue. In particular it looks like this issue is definitely a blocker: https://www.drupal.org/node/2648496
Just out of curiosity, why can't I see the "Add Custom Block" button in your first image? I've set the "Seven" to the default them...
Hi NeedHelp,
This has changed in more recent versions of Drupal core. Core now includes a menu tab on that page to the "Custom block library". You can find the "Add custom block" link there. The path is "admin/structure/block/block-content" if you want to navigate there directly.
Add new comment