O'Reilly logo

Drupal 8 Module Development by Daniel Sipos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required