After adding the blockswitcher block to a page I am getting the following errors:
Warning: Invalid argument supplied for foreach() in element_children() (line 6548 of /var/www/html/cmhr.openplus.ca/includes/common.inc).
Warning: Illegal string offset '#children' in drupal_render() (line 6012 of /var/www/html/cmhr.openplus.ca/includes/common.inc).
Warning: Illegal string offset '#children' in drupal_render() (line 6022 of /var/www/html/cmhr.openplus.ca/includes/common.inc).
Warning: Illegal string offset '#children' in drupal_render() (line 6060 of /var/www/html/cmhr.openplus.ca/includes/common.inc).
Warning: Illegal string offset '#printed' in drupal_render() (line 6067 of /var/www/html/cmhr.openplus.ca/includes/common.inc).
In looking at the code it appears that the error comes from openlayers_plus_behavior_blockswitcher.inc line 69 in the render function when drupal_render($block) is called:
public function render(&$map) {
drupal_add_js(drupal_get_path('module', 'openlayers_plus')
. '/behaviors/openlayers_plus_behavior_blockswitcher.js');
drupal_add_js('misc/jquery.cookie.js', 'file');
if ($this->options['enabled']) {
$block = module_invoke('openlayers_plus', 'block_view', 'blockswitcher');
$this->options['block'] = drupal_render($block);
I don't think the render function likes the $block array that is being provided. I am not 100% sure, but I think it would make more sense to change this line to this which makes the errors go away and works properly:
$this->options['block'] = drupal_render($block['content']);
If it is agreed that this is the proper solution I would be happy to provide a patch.
Comments
Comment #1
davidserene commentedHi joel_osc, ive tried your solution and it does make the errors go away; we would be happy to receive your patch. Thanks
Comment #2
joel_osc commentedComment #3
joel_osc commentedPatch uploaded for review.
Comment #4
davidserene commentedThank you, I have pushed the changes to 7.x-3.x
Comment #5
batje commented