8

Plug and Play with Plugins

Plugins power many items in Drupal, such as blocks, field types, and field formatters. Plugins and plugin types are provided by modules. They provide a swappable and specific functionality.

In this chapter, we will implement a block plugin. We will use the Plugin API to provide a custom field type along with a widget and formatter for the field. The last recipe will show you how to create and use a custom plugin type.

Upcoming changes to the plugin system in Drupal minor versions

PHP 8 provides a feature called PHP attributes (https://www.php.net/manual/en/language.attributes.overview.php). With Drupal 10’s adoption of PHP 8.1, there is consideration to adopt PHP attributes over code document annotations, which are ...

Get Drupal 10 Development Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.