3

I am using menu blocks and context to create menus on a site. I have created the menu blocks and added contexts for there use (they are working on my local dev). I have exported the menu blocks to code using fe block and strongarm per the recommendations in Drupal.org I am doing the following after versioning the code to git and pulling it to the new server:

drush fr <feature_module>
    "Do you really want to rever variable? (y/n) y
$ Variable reverted
    "Do you really want to revert <feature_module>? (y/n) y
$ <feature_module> revert

I clear the cache, go into the new site->admin->Structure->Features-> and the variables are listed under strongarm and the menu_blocks are listed on Block settings.

But the menus are not showing on the page. A look in blocks and the menu are not there. It appears they weren't built.

Am I missing a step? Please help.

Thank you in advance

1
  • I was running into this issue as well... for some weird reason, I had to manually update the menu_block_ids variable in an update function, then the exported menu block appeared correctly: variable_set('menu_block_ids', array(1, 2, 3)); (basically I added in the 3rd ID in that list). Dec 31, 2015 at 21:33

1 Answer 1

1

You need to select also, in the feature, under strongarm, the "menu_block_ids" variable. Also make sure that the dependency to strongarm is selected. Sometimes it shows the select box but it is left unchecked.

With that the menu block should appear in the blocks page.

It will not appear in the context->edit->menu block though, and I think that is an issue. I am doing more tests before I really open it though.

----alternatively

Don't do it with fe features or strongarm, instead, just use menu block export module (go there admin/config/user-interface/menu-block/export) and proceed, just put any name and click export.

Copy the resulting code in your feature.module (make sure you put the proper name). Something like this:

function feature_name_menu_block_blocks() {
// The array key is the block delta used by menu block.
  return array(
    '23' => array( // feel free to change this to the real id of your menu block
      'parent'      => 'menu-api-menu:0',  //the module might not encapsulate string, be careful
      'title_link'  => 0,
      'admin_title' => 'title',
      'level'       => 1,
      'follow'      => '0',
      'depth'       => 0,
      'expanded'    => 1,
      'sort'        => 0,
    ),
  );
}

Just copy the menu block you want to export, you dont have to copy all of them.

Your Answer

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

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