3

I created a custom theme and I was wondering if there is way to export my block layout settings (location and order of each block). This way will be easier to apply my theme in a different site.

I'm using the Features module to keep on track of my custom blocks and block types.

  • 1
    Yes, just enable config core module and export the blocks(they are basically just instances of blocks) via admin/config/development/configuration/single/export and put them into your theme's config/install directory. – user21641 Dec 28 '15 at 17:54
1

This question is about D8, for which you can use an approach as suggested in the comment from Ivan Jaros, i.e.:

... enable config core module and export the blocks (they are basically just instances of blocks) via admin/config/development/configuration/single/export and put them into your theme's config/install directory.

What not everybody may know, is that this kind of block related facilities that are new in D8, is actually because of the Bean module which has been included with Drupal 8 core (refer to this issue for more information).

This implies that a similar question for D7 can be resolved also by using the Bean module. Here is a quote about its project page:

Think of a Bean as a method to provide new types (compared to node this would be a content type) which then provides an add content interface to create as many blocks as you require (see screenshot below). The bean content can then be placed around the site just like any other block.

This module also works great in combination with the UUID and UUID Features Integration modules. And after you become familiar with the Bean module, you might find other cases in your site where you also want to use this module (which somehow compensates the fact that you need to add another module).

The video tutorial Drupal Bean module tutorial - using Bean Admin UI provides a great introduction to really understand the power of this module, and the kind of things you can do with it (by only using site building techniques, no custom coding involved). It also shows how the Bean module transforms Drupal blocks into fieldable entities.

This module only started as of D7 (because of the "entities" of course that were only introduced in D7), and already has over 22K reported installs. Those who don't use it yet (in D7) should definitely start looking at it in preparation of some day upgrading to D8.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.