Add a block to a render array I have a block I would like to add it to my renderable array (given to a page callback), with prefix and suffix - what's the cleanest way to do this?

I understand I can do it this way:

$markup = '';
if ($block = block_load('views','results_anonymous-block')) {
    $block_content = _block_render_blocks(array($block));
    $build = _block_get_renderable_array($block_content);
    $markup = drupal_render($build);
}


$content['page'] = array(

    '#markup' =&gt; $markup,
);

return $content;


But wondered if there was a better way (e.g. without rendering the block or using the private function).
Modules provide their block titles and contents through implementations of hook_block_view(). If you're looking for something similar to your posted code that doesn't rely on calls to private functions, what's below should give you a render-ready array that you can place anywhere within another render array.

$renderable_block_data = module_invoke('views', 'block_view', 'results_anonymous-block');
$renderable_block_contents = $renderable_block_data['content'];


Caveat: while the docs for D7's version of hook_block_view() suggest that the returned "content" key should be a render array, some modules/blocks may be implemented in such a way that they return plain HTML strings, in which case you'd need to put the content in a #markup element before adding them to your parent render array.

Further discussion can be found in this drupal.org post.