The Drupal 8 plugin system allows a particular module or subsystem to provide functionality in an extensible, object-oriented way. The controlling module defines the basic framework (interface) for the functionality, and other modules can create plugins (implementing the interface) with particular behaviors. Plugins are grouped into plugin types. Each plugin type is managed by a plugin manager service, which uses a plugin discovery method to discover provided plugins of that type and instantiate them using a plugin factory.
A block is a reusable widget that is placed inside regions (layout containers) of your theme. Blocks can be created, removed, rearranged, and configured in the Block layout administration page. Examples of blocks include the "Who's online" listing, the main navigation menu, and the breadcrumb trail. The main page content is also a block. Each block has its own configuration settings, which allow you to select which pages of your site will display the block.
A module can provide a block using the Plugin API. When a module provides a block, it is listed on the Block layout administrative page and can be placed in a region by a site administrator. Many tools, like Views or menus, have the ability to generate new blocks based on configuration, which can then be placed into regions.
- Rearrange blocks in a theme by placing them in specific regions
- Customize the visibility of a block for certain pages or types of pages
- Provide a block in a module using the Plugin API
The Block layout system underwent many changes and transformations during Drupal 8's development cycle. Be sure to scrutinize or avoid resources that were published before Drupal 8's official release (November 2015), as they can confusingly refer to configuration screens that have since been redesigned.
Blocks are created using the Plugin API. Any module developer wishing to implement a new block will need to understand how the Plugin API works.