Entity revisions

In Drupal 8, all content entity types are easily revisionable with only a few settings on the plugin annotation. Since Node is such an example, we can check out its definition which has two main options to make it so.

First, we have the database table information where revisions are stored. This mirrors exactly the original tables we saw before:

 *   revision_table = "node_revision", *   revision_data_table = "node_field_revision",

Second, we have the entity key for the revision ID we saw earlier:

 *   entity_keys = { *     ... *     "revision" = "vid", *     ... *   },

The entity fields are not automatically revisioned so a flag needs to also be set on them.

Get Drupal 8 Module Development 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.