I'm trying to render a view into a region in hook_page_build(). I'm using views_embed_view(), but I'm getting the errors:
Warning: Invalid argument supplied for foreach() in element_children() (line 6428 of /var/www/.../includes/common.inc). Warning: Illegal string offset '#children' in drupal_render() (line 5893 of /var/www/.../includes/common.inc). Warning: Illegal string offset '#children' in drupal_render() (line 5903 of /var/www/.../includes/common.inc). Warning: Illegal string offset '#children' in drupal_render() (line 5941 of /var/www/.../includes/common.inc). Warning: Illegal string offset '#printed' in drupal_render() (line 5948 of /var/www/.../includes/common.inc).
I have a view named 'blogs' and a view named 'block_2'. In my hook:
function mymod_page_build(&$page) {
$page['sidebar_second']['blogs'] = views_embed_view('blogs', 'block_2');
}
I'm trying to move away from blocks and context, and just render content I'd otherwise use in blocks directly into their regions in hook_page_build().