13

I am trying to learn about creating a reasonable workflow between a development site and a production site and I have decided to use the Features module to help accomplish this task.

On my front page I have a couple blocks that display newly added and top rated content. I have used features to export these views but I do not see anyway inside of the Features module to export my block settings. I set the new projects and highest rated blocks to show up in the content section of a page. I filter it to only show up on the front-page inside the view.

How to export these block settings inside my feature so I do not need to reconfigure them on each site?

13

You can export much more using Feature together with Strongarm and Features extra.

Strongarm gives site builders a way to override the default variable values that Drupal core and contributed modules ship with. It is not an end user tool, but a developer and site builder tool which provides an API and a limited UI.

Features extra supports: vocabularies; nodequeues (definitions); block settings; custom blocks (boxes).

Additionally UUID Features Integration provides a mechanism for exporting content (nodes, taxonomy, fields) into a features module.

  • 1
    I would also recommend using drush and git to handle the workflow. – Refineo Apr 4 '12 at 18:03
  • 1
    Awesome that's exactly what I needed. I was planning on getting git going once I figured out how to use features a little better. – Mike2012 Apr 4 '12 at 18:12
  • Fantastic ! As Mike, that's just incredible ! – Jean-Rémy Revy Nov 30 '12 at 14:49
4

You could use the Boxes module as per Exporting of blocks for features.

If you'd rather not install additional modules, and you're dealing with a Views block (where you simply need the block configuration settings), another option is to do this at the code level with a hook_update_N() implementation in a custom module's install file. See below for an example.

/**
 * Configure block settings.
 */
function my_module_update_7101() {

  // Enable blocks
  db_update('block')
    ->fields(array(
      'status'     => 1,
      'region'     => 'content',
      'visibility' => 1,
      'pages'      => 'node/999',
      'title'      => 'My Block Title',
      'css'        => '',
      'js'         => '',
    ))
    ->condition('delta', 'BLOCK_ID')
    ->execute();
}
0

An alternative is to use mini-panels instead of custom blocks as been suggested here. They work much the same, and panels appear to be better supported by features. If you already plan to use panels, this also saves a few extra modules.

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.