Create a Hello World block plugin

Create a block that displays "Hello World".

Instructions

  • Create a new custom module.
    • Create a new directory web/modules/custom/hello_world_block.
    • Create a new file web/modules/custom/hello_world_block/hello_world_block.info.yml
  • Create HelloWorldBlock.php file in web/modules/custom/hello_world_block/src/Plugin/Block/
  • Set namespace to Drupal/hello_world_block/Plugin/Block
  • Create class that extends BlockBase.
    • Set id and admin_label in annotation.
  • Implement build() function.