Drupal 8 – Create a block plugin

This continues on from the previous post where we created a simple module. In this post we add a basic block, which is pretty easy as it turns out.

Create a new file at lib/Drupal/thrones/Plugin/Block/ThronesExampleBlock.php and add the following:

Clear the cache and you should be able to add the block.

3 thoughts on “Drupal 8 – Create a block plugin

  1. dlu

    It seems that in D8 new block no longer appear in admin/structure/block automatically. They have to be “placed” do you know if there is a way to do that programmatically?


Leave a Reply

Your email address will not be published. Required fields are marked *