Create a custom block plugin
Blocks in Drupal are instances of the block plugin.
Add a Form to the Block Configuration
Now let us say that we want to add the ability for the site builder to enter a piece of configuration for each instance of our custom block.
Process the Block Config Form
Add the following method to the HelloBlock class. In this example, it is located in the src/Plugin/Block/HelloBlock.php file, but as you
Use Config in Block Display
To make use of the configuration of instances of the block, we can modify the build() method of the HelloBlock class: