By seanb on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.3.x
Introduced in version:
8.3.0
Description:
The logic to enable revision fields on a revisionable content entity was moved to ContentEntityForm. To use this in a revisionable content entity the show_revision_ui annotation was added.
Before
Before every revisionable content entity had to take care to create all the required logic in its own form.
After
The show_revision_ui annotation was added to ContentEntityType to define if a content entity wants to add revision fields to the form. The logic also depends on having the revision key set for the content entity. The form fields will only be added when both annotations are added.
Use it like this:
/**
* Defines the node entity class.
*
* @ContentEntityType(
* id = "node",
* label = @Translation("Content"),
* ...
* show_revision_ui = TRUE,
* ...
* entity_keys = {
* ...
* "revision" = "vid",
* ...
* },
* ...
* )
*/
Impacts:
Module developers