I have a plugin block that returns a render array based on taxonomy of the node. I want to make a default custom block appear when there's no taxonomy term selected. I've tried this:

else {
  $block = Block::load('default_cta');
  $render = \Drupal::entityManager()->
  return $render;

Which is how I'd render a content block, but this throws Call to undefined method Drupal\\block\\Entity\\Block::isDefaultRevision(). This post How can I programmatically display a block? describes the difference between a content block and plugin block, and I'm guessing I can't call one within the other. Is there another way to do this without creating the default render array from scratch?


Your Answer

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

Browse other questions tagged or ask your own question.