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.
In admin/structure/block
, I have deleted all instances of the message block. But the block is still displayed in the content region... The only solution I could find is to unset the "messages" variable in preprocess_page: unset($vars['page']['content']['messages']);
I am not sure, but I think this problem is the same for all global block...
Comments
Comment #2
DuneBLOf course, the same problem arise if I deactivate the block (instead of deleting it)
Comment #3
tim.plunkettThis is done purposefully in \Drupal\block\Plugin\DisplayVariant\BlockPageVariant::build()
Before #2289917: Convert "messages" page element into blocks, messages were not a block. When it was converted, it was made required.
Only the messages and the main content block are special-cased.
Comment #4
DuneBLMany thanks for this usefull information.
But this not fit my use case: I need to display the message block from within a node temple (not a page template)
I nee this for layout purposes.
In my node template, I am displaying a de-activated message block
But in my preprocess page, I must
unset($vars['page']['content']['messages']);
which is not verry beautifull (but still working)