not listed

Programmatically create a custom block in Drupal 8

  1. It seems that we cannot create a custom block in existing modules on drupal 8. So you must create a new custom module first.
    • create a .info.yml file like so:¬†/modules/custom_blocks/
      name: All My Custom Blocks
      type: module
      description: Defines a custom block.
      core: 8.x
      package: Custom
        - block
  2. Create the following file /modules/custom_blocks/src/Plugin/Block/MyFirstBlock.php
Subscribe to RSS - not listed