Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Could be related to #966768: Notice: Undefined property: stdClass::$content in _block_get_renderable_array when saving a configured context, but since that's an old issue, here's a new one.
Per https://drupal.org/node/966768#comment-6899716, the issue appears when using
if ($plugin = context_get_plugin('reaction', 'block')) {
$variables['sidebar_content'] = $plugin->block_get_blocks_by_region($region);
}
Adding drupal_static_reset('context_reaction_block_list');
solves the issue but it is a performance killer, depending on where you called it.
Comments
Comment #1
rrrob CreditAttribution: rrrob commentedNot a fix, but a workaround. I use this in my template.php as a helper function.
Comment #2
bjorsen CreditAttribution: bjorsen commentedThanks rrrob, that seems to work nicely for me too with a small change to the last conditional (using the $region var instead of hard-coded region name).
Comment #3
kumkum29 CreditAttribution: kumkum29 commentedHello,
i get the same notices on my site when I defines a region in a _preprocess_views_view(&$variables) function.
I want to insert a custom region in a views-view...template.
I use this code:
I have tested your funcion without success.
Should I change anything in my function for resolve this?
Thanks for your help.
Comment #4
kumkum29 CreditAttribution: kumkum29 commentedHello bjorsen or rrrob,
where do you placed this function? I copied this code in my template.php, renamed 'my theme' with the name of my theme and cleared the cache without success.
Do I must copy this function before or after to my code:
Thanks for your help.
Comment #5
bjorsen CreditAttribution: bjorsen commentedHi kumkum29,
apologies for the slow response. I hadn't noticed any activity on this issue.
For future reference: you define the custom function in your template.php file and then call that custom function instead of the default to assign the content to the region. See example below based on your code.
$variables['region_right'] = _mytheme_blocks_by_region('right');