Change record status: 
Project: 
Introduced in branch: 
8.1.x
Description: 

There are many improvements for defining entity types.

  1. When defining the base fields of an entity you no longer have to define ID, UUID, bundle, langcode as well as revision ID. They are autogenerated now in ContentEntityBase::baseFieldDefinitions(). Just make sure you call the parent implementation.
  2. In addition to generating edit-form and delete-form routes, DefaultHtmlRouteProvider and AdminHtmlRouteProvider now also generate add-page and add-form routes. Add the corresponding link templates and make sure the route provider is present to have them generated:
      "handlers" = {
        "route_providers" = {
          "html" = "\Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
        },
      },
      links = {
        "add-page" = "/node/add",
        "add-form" = "/node/add/{node_type}",
    
  3. Entities can provide additional information to revisions on top of just the revision ID:
    • The time the revision got created
    • The user which created the revision
    • A message alongside the revision

    In order to use it, either extend \Drupal\Core\Entity\RevisionableContentEntityBase or implement \Drupal\Core\Entity\RevisionLogInterface
    and leverage the \Drupal\Core\Entity\RevisionLogEntityTrait

Impacts: 
Module developers