- Drupal 8 Development Cookbook(Second Edition)
- Matt Glaman
- 126字
- 2025-04-04 18:20:51
How it works...
In the Drupal 8 plugin system, there is a concept called Derivatives. Plugins are small pieces of swappable functionality within Drupal 8. Plugins and plugin development are covered in Chapter 7, Plug and Play with Plugins. A derivative allows a module to present multiple variations of a plugin dynamically. In the case of Views, it allows the module to provide variations of a ViewsBlock plugin for each view that has a block display. Views implements the \Drupal\views\Plugin\Block\ViewsBlock\ViewsBlock class, providing the base for the dynamic availability of these blocks. Each derived block is an instance of this class.
When Drupal initiates the block, Views passes the proper configuration required. The view is then executed and the display is rendered whenever the block is displayed.