Skip to content

Commit dd6cab9

Browse files
committed
Generating content entities should extend EditorialContentEntityBase, not RevisionableContentEntityBase fixes #199
1 parent 709863c commit dd6cab9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

templates/Entity/_content-entity/src/Entity/Example.php.twig

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use Drupal\Core\Field\BaseFieldDefinition;
2323
use Drupal\Core\Entity\ContentEntityBase;
2424
{% endif %}
2525
{% if revisionable %}
26-
use Drupal\Core\Entity\RevisionableContentEntityBase;
26+
use Drupal\Core\Entity\EditorialContentEntityBase;
2727
use Drupal\Core\Entity\Form\RevisionDeleteForm;
2828
use Drupal\Core\Entity\Form\RevisionRevertForm;
2929
use Drupal\Core\Entity\Routing\RevisionHtmlRouteProvider;
@@ -68,6 +68,9 @@ use Drupal\{{ machine_name }}\{{ class }}AccessControlHandler;
6868
'label' => '{{ label_base_field ? 'label' : 'id' }}',
6969
{% if author_base_field %}
7070
'owner' => 'uid',
71+
{% endif %}
72+
{% if status_base_field %}
73+
'published' => 'status',
7174
{% endif %}
7275
'uuid' => 'uuid',
7376
],
@@ -159,7 +162,7 @@ use Drupal\{{ machine_name }}\{{ class }}AccessControlHandler;
159162
],
160163
{% endif %}
161164
)]
162-
final class {{ class }} extends {% if revisionable %}Revisionable{% endif %}ContentEntityBase implements {{ class }}Interface {
165+
class {{ class }} extends {% if revisionable %}Editorial{% endif %}ContentEntityBase implements {{ class }}Interface {
163166
164167
{% if changed_base_field or author_base_field %}
165168
{% if changed_base_field %}

tests/functional/Generator/Entity/_content_entity/_yes/src/Entity/FooExample.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Drupal\Core\Entity\Form\DeleteMultipleForm;
1313
use Drupal\Core\Entity\Form\RevisionDeleteForm;
1414
use Drupal\Core\Entity\Form\RevisionRevertForm;
15-
use Drupal\Core\Entity\RevisionableContentEntityBase;
15+
use Drupal\Core\Entity\EditorialContentEntityBase;
1616
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
1717
use Drupal\Core\Entity\Routing\RevisionHtmlRouteProvider;
1818
use Drupal\Core\Field\BaseFieldDefinition;
@@ -40,6 +40,7 @@
4040
'bundle' => 'bundle',
4141
'label' => 'label',
4242
'owner' => 'uid',
43+
'published' => 'status',
4344
'uuid' => 'uuid',
4445
],
4546
handlers: [
@@ -92,7 +93,7 @@
9293
'revision_log_message' => 'revision_log',
9394
],
9495
)]
95-
final class FooExample extends RevisionableContentEntityBase implements FooExampleInterface {
96+
class FooExample extends EditorialContentEntityBase implements FooExampleInterface {
9697

9798
use EntityChangedTrait;
9899
use EntityOwnerTrait;

0 commit comments

Comments
 (0)