Last active
September 25, 2015 17:17
-
-
Save sobi3ch/956293 to your computer and use it in GitHub Desktop.
Programmatically insert block when you need it (D6)
This file contains 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
<?php | |
function blue_get_block($module, $delta, $subject = '') { | |
$block = new stdclass; // empty object | |
$array = module_invoke($module, 'block', 'view',$delta ); | |
// must be converted to an object | |
// @see block_list() | |
if (isset($array) && is_array($array)) { | |
foreach ($array as $k => $v) { | |
$block->$k = $v; | |
} | |
} | |
$block->module = $module; | |
$block->delta = $delta; | |
$block->region = 'blue'; | |
$block->subject = $subject; | |
$block->block_html_id = "block-{$block->module}-{$block->delta}"; | |
return theme('block', $block); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment