You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Its a bit confusing core has both of these classes, but when generating content entities there is a slight nuance between the two. EditorialContentEntityBase seems better supported for both revisioning and moderation with its additional traits over the former.
abstract class EditorialContentEntityBase extends ContentEntityBase implements EntityChangedInterface, EntityPublishedInterface, RevisionLogInterface {
use EntityChangedTrait;
use EntityPublishedTrait;
use RevisionLogEntityTrait;
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
// Add the revision metadata fields.
$fields += static::revisionLogBaseFieldDefinitions($entity_type);
// Add the published field.
$fields += static::publishedBaseFieldDefinitions($entity_type);
return $fields;
}
}
The published field then allows Content Moderation to be used on the entity.
In addition, Entities should likely come with the following entity_keys:
This would enable automatic support for Content Moderation in core for custom entities. If someone choses that they should be revisionable, this is probably what they are after. If they do not use Content Moderation, it looks like they get the same result right now and should not break anything (at a glance).
The text was updated successfully, but these errors were encountered:
Its a bit confusing core has both of these classes, but when generating content entities there is a slight nuance between the two. EditorialContentEntityBase seems better supported for both revisioning and moderation with its additional traits over the former.
The published field then allows Content Moderation to be used on the entity.
In addition, Entities should likely come with the following entity_keys:
This would enable automatic support for Content Moderation in core for custom entities. If someone choses that they should be revisionable, this is probably what they are after. If they do not use Content Moderation, it looks like they get the same result right now and should not break anything (at a glance).
The text was updated successfully, but these errors were encountered: