0

I implement mymodule_block and for case 'list' I have blocks like:

  $blocks[CN_BLOCK_RHM_BUTTONS] = array(
        'info' => t("Block name"),
        'status' => 1, // on by default
        'weight' => -99, // should be at the top
        'region' => 'right', // RHM
        'visibility' => 1, // Only on these pages
        'pages' => 'page1' . PHP_EOL . 
          'page2' . PHP_EOL . 
          'page3' . PHP_EOL

This works great for new blocks created on our dev site. But I want to change the pages settings in source control, and for these changes to propagate when we updated this module on our production site. It seems that for existing module deltas, Drupal looks at the block table fields and ignores any changes in hook_block. If these any feature of Drupal or cool snippet that will help me 'reset' blocks to the module's settings?

1

You can achieve this by writing a hook_update in your module's .install file. You will need to update the 'block' table directly in that hook to change the block settings as needed. After moving your updates to production, run update.php, which will apply the changes in hook_update.

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.