
In Drupal 8, all field types, widgets, and formatters are plugins.
They are automatically discovered if placed in the expected directory structure and use the correct annotation.
The directory structure for a module that implements all three looks like this:
foo_bar_fields


This documentation page will soon provide an overview of updating multilingual sites from Drupal 7 to Drupal 11. At the moment, the page is incomplete.
In the meantime, you can refer to the following resources:


The Database API throws exceptions on error, which can be caught by wrapping database operations in try {} catch() {} blocks, as shown in this example:


In Drupal 8, bundles are a type of container for information that hold field definitions or settings. They are sometimes referred to as “subtypes.” Bundles are optional and sit under entity types in the hierarchy of information containers.


Create new EPT Settings form class
I heard from many programmers worries about number of settings for EPT modules: DOM Box, background, borders, classes, etc. These programmers implied that content editors will be confused or in another way will be encouraged to do drastically different paragraphs, margins, backgrounds. Some projects needs flexibility and more settings for content editors, but some projects have pretty strict story books with components. For this case we need to change our EPT Settings field widget.


EPT modules allow to override templates in your custom theme.
There is a new theme suggestion with --custom suffix, so you can override template in your custom theme:


EPT modules allow to override templates in your custom theme.
There is a new theme suggestion with --custom suffix, so you can override template in your custom theme:


PHP 8 introduced constructor property promotion, a feature that simplifies class property definition and assignment by letting you declare and initialize properties in the constructor signature. This tutorial demonstrates how to use constructor property promotion in Drupal custom modules (which require PHP 8.0+), specifically to simplify dependency injection in your services and controllers. We will compare the traditional Drupal pattern (used in PHP 7 and early Drupal 9) with the modern PHP 8+ approach, using full code examples for both.


Sometimes you need fixed, permanent Categories on the site, which should be updated accedentially. In this case you can utilize custom code with Event Subscribe.
Let's add a new Event Subscriber class in custom module.
drupalbook_custom.services.yml


Often we face 500 error page when Drupal, services or another sites are not available. When we see 500 (or 501-504) error page. In Drupal we use Exceptions to check some critical code was executed. If we got an error, for exaple in HTTP request to another site when Drupal will show this error "The website encountered an unexpected error. Please try again later":
