Skip to content

Instantly share code, notes, and snippets.

@EclipseGc
Created September 21, 2012 16:24
Show Gist options
  • Save EclipseGc/3762463 to your computer and use it in GitHub Desktop.
Save EclipseGc/3762463 to your computer and use it in GitHub Desktop.
<?php
function _block_get_renderable_block($element) {
$block = $element['#block'];
// Don't bother to build blocks that aren't accessible.
if ($element['#access'] = $block->access()) {
$build = $block->build();
if ($build) {
if (isset($build['#title'])) {
$element['#title'] = $build['#title'];
}
$element += $build;
}
else {
$element = array();
}
}
return $element;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment