1

I'm about use Features to deploy all configuration of my Drupal (7) site.

Now I'm wondering if there is a way to export the entire settings for block to region assignment without having to export all blocks into one big feature.

One big feature containing all blocks would create conflicts with other, more atomic feautures. Even worse, it seems only blocks that have a region assigned seem to be exportable, so I can't figure out yet how to export my defintions of disabled blocks. For example: I move a previously displayed block to the disabled region - is there a way to deploy this setting to remove the block on the staging site, too?

2 Answers 2

4

We abandoned managing the blocks through the normal Structure->Blocks page a long time ago. Now we use it simply to set block titles, and the individual block's settings.

For assignment onto pages we use Context module:

Context allows you to manage contextual conditions and reactions for different portions of your site. You can think of each context as representing a "section" of your site. For each context, you can choose the conditions that trigger this context to be active and choose different aspects of Drupal that should react to this active context.

Think of conditions as a set of rules that are checked during page load to see what context is active. Any reactions that are associated with active contexts are then fired.

This module lets you assign blocks to regions using criteria based on more than just page paths, such as taxonomy term of the content, type of content etc. And also it allows you to react with more than just blocks as well. Also one block can be assigned to different regions using more than just 1 context.

Overall the most important thing to this question regarding Context module is, the context rules are exportable via features!

6
  • Thanks a lot, I've used context to assign blocks previously but haven't thought of it for my current project. Will try immediately! The other good thing is that block configuration and block-to-region assignment is nicely separated. Commented Oct 10, 2013 at 10:30
  • Works like a charm, from now on I will also be using only Context to assign blocks to regions :) Commented Oct 10, 2013 at 11:11
  • One question remains, though. How do you export blocks to Features that are not assigned to regions? They don't show up as available blocks to check when generate a Feature. Commented Oct 10, 2013 at 11:49
  • What version of Features are you using? The one I have installed (7.x-1.0 not the latest I know) doesn't have the option to export "Blocks". As far as I know, custom made blocks through "Structure -> Blocks -> Add block" are not exportable. We always tend to create these on the main database (live database, along with all the content and metatags etc) so that we don't need to migrate them at all.
    – Beebee
    Commented Oct 10, 2013 at 12:58
  • I'm using Features Extra to be able to export blocks. May I ask how you manage creation and deployment of menus? I'm using Menu Blocks but still having general issues deploying these (inconsistent node ids on different machines etc.) Commented Oct 10, 2013 at 13:06
0

You can consider using Features Extra which allows export of blocks which includes settings such as region, visibility, etc. Or try Blockexport module.

Alternative solutions to blocks are:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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