Entity type plugins

Entity types are registered with Drupal as plugins. Yes, again. The Drupal\Core\Entity\Annotation\EntityType class is the base annotation class for these plugins and you will mainly see two subclasses (annotations): ContentEntityType and ConfigEntityType. These are used to register content and configuration entity types, respectively.

The annotations classes map to plugin classes used to represent the entity types. The base class for these is Drupal\Core\Entity\EntityType, which is then extended by another ContentEntityType and ConfigEntityType. These plugin classes are used to represent the entity types in the system and are a good resource for seeing what kind of data we can use on the annotation of these plugins. At a quick glance we can already see that the differences between the two types is not so big.

The plugin manager for entity types is the EntityTypeManager, an important service you will probably interact with most as a Drupal developer. Apart from various handy things we will see a bit later, it is responsible for managing the entity type plugins using the regular annotation-based discovery method.

The Node entity type is defined in Drupal\node\Entity\Node, where you will see a huge annotation at the top of the class. The NodeType configuration entity type, on the other hand, is found in Drupal\node\Entity\NodeType. You can spot the difference in the annotation they use.