This issue has been bugging me for some time and maybe this is just how Drupal is or I am missing something. Anyway, the setup is like this:

I have my defined regions on the site. One region is Hero. Hero as a region should have two things:

  1. A block that displays an image with some text overlay. (Hero Block)
  2. A block that displays relevant notifications if applicable (Alert Block)

Both of these blocks are custom block plugins with a class and template housed in a custom module. These blocks render and work just fine on any of the pages for my custom content types. They however don't render on Group pages or View pages.

So that is my question: Why don't my custom block plugins show on my Group or View pages. Is this by design? All other menu, footer, etc. blocks show just fine on these pages but not my custom blocks. If I set a breakpoint in the build() method in my blocks the breakpoint does not even hit so its like they are not even trying to render.

Is this desired Drupal functionality or am I missing something? I could probably use Twig Tweak or render the blocks via preprocessor but I only want to do so as a last resort.

  • If the Group or View pages are backend pages, then yes, this is by design. There are tabs at the top of the block layout to switch themes. By default, most core blocks like menu or message block are present in all themes.
    – 4uk4
    Commented Mar 16 at 8:37
  • Thank you @4uk4 for your input. The issue was some ContextDefinitions on the blocks causing issues.
    – rtoombs44
    Commented Mar 16 at 17:46

1 Answer 1


I figured it out. If anyone has a similar issue mine was caused by a ContextDefinition I placed on the block. The context was of type node so I suppose it would make sense that the block was not trying to render in places outside of this context.

Adding required = FALSE to the definition and adding another ContextDefinition for group entities resolved my issue. I did have to replace the block(s) on the blocks layout page for this to take effect.

context_definitions = {
    "node" = @ContextDefinition("entity:node", label = @Translation("Node"), required = FALSE),
    "group" = @ContextDefinition("entity:group", label = @Translation("Group"), required = FALSE),

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.