Created
January 21, 2014 14:03
-
-
Save kevin-coyle/8540638 to your computer and use it in GitHub Desktop.
Modified from http://dcycleproject.org/blog/32/disabling-blocks A simple helper function to disable blocks programatically. Useful for deployment modules.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper Function to disable blocks | |
* Modified from http://dcycleproject.org/blog/32/disabling-blocks | |
* @param string $theme The name of the theme you'd like the block to be disabled on | |
* @param array $blocks Array of blocks. Module => Block name | |
*/ | |
function disable_block($theme, $blocks) { | |
foreach ($blocks as $module => $delta) { | |
$num_updated = db_update('block') // Table name no longer needs {} | |
->fields(array( | |
'region' => '-1', | |
)) | |
->condition('module', $module, '=') | |
->condition('delta', $delta, '=') | |
->condition('theme', $theme, '=') | |
->execute(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment