3

I have a bash script that I use to rebuild my dev environment by re-importing my MySQL database and activating/deactivating modules, etc.

Recently, I've realised that I often need the Switch user block provided by the Devel module.

So, ideally, in my script, I'd like to automatically enable the module in the left sidebar.

This question on how to place a block with Drush looked promising but it suggests using Drush Extras, which according to the README does not work for Drupal 7.

How can I automatically set the position of the Switch user block from the command line?

1
  • Why not by directly querying DB? Drush can do that, so simply updating one table to assign block to region should be doable.
    – Mołot
    Commented Nov 24, 2013 at 11:08

1 Answer 1

3

Updated answer:

I just committed https://drupal.org/comment/7000524 to support the Drush block commands in Drupal 7. I also added a shortcut mode, where arguments can be used in place of options in instances where doing so would be unambiguous. When calling block-configure from a bash script, though, you should always use the options form; otherwise, your script would break if a specification became ambiguous (e.g. if someone added a block whose delta was named the same as some region).

So, from the commandline:

$ drush block-configure switch_user sidebar_second 10

From a bash script:

drush block-configure --module=devel --delta=switch_user --region=sidebar_second --weight=10

The later works just fine from the command line, of course; it's just more typing.

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.