In Drupal 7, adding a block was just a matter of implementing a hook such as hook_block_info()
and a few more in a custom module. The block then was available in the user interface for you to place wherever you wanted.
In Drupal 8, custom blocks provided by a module implement the Block Plugin API, which is a subset of the more generic Plugin API. What used to be info hooks that returned arrays for block discovery is now composed of Annotations and the use of PSR-0, so Drupal can both find and understand your blocks. Callback functions that returned the content of your block are now methods on Drupal\block\BlockPluginInterface
that we can override as needed in our custom block code.
Creating a block in Drupal 8 requires creating a plugin according to the Plugin API and annotation-based plugin discovery. Throughout the book, we have seen both of these at play when creating field widgets or CKEditor profiles.
A workflow of creating a block can be visualized...