I have a couple of blocks that have been created using the ... extends BlockBase
syntax in my module. They work perfectly fine, and I can add them on the blocks layout page, can add them into DS as a field, etc. They definitely exist fine.
However, when I try and render them using Block::load()
, they won't show up, unlike other blocks that work fine.
For example, if I have the following docblock:
/**
* Provides a 'Cute Cats' Block.
*
* @Block(
* id = "cute_cats",
* admin_label = @Translation("Cute cats yo"),
* )
*/
class CuteCats extends BlockBase { ... }
... and then try and call it like this:
$block = \Drupal\block\Entity\Block::load('cute_cats');
return render(\Drupal::entityTypeManager()
->getViewBuilder('block')
->view($block));
Any idea why? Thanks in advance.