diff core/modules/block_content/src/Entity/BlockContent.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
line wrap: on
line diff
--- a/core/modules/block_content/src/Entity/BlockContent.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/core/modules/block_content/src/Entity/BlockContent.php	Mon Apr 23 09:46:53 2018 +0100
@@ -2,8 +2,7 @@
 
 namespace Drupal\block_content\Entity;
 
-use Drupal\Core\Entity\ContentEntityBase;
-use Drupal\Core\Entity\EntityChangedTrait;
+use Drupal\Core\Entity\EditorialContentEntityBase;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Field\BaseFieldDefinition;
@@ -51,7 +50,8 @@
  *     "bundle" = "type",
  *     "label" = "info",
  *     "langcode" = "langcode",
- *     "uuid" = "uuid"
+ *     "uuid" = "uuid",
+ *     "published" = "status",
  *   },
  *   revision_metadata_keys = {
  *     "revision_user" = "revision_user",
@@ -68,9 +68,7 @@
  * caching.
  * See https://www.drupal.org/node/2284917#comment-9132521 for more information.
  */
-class BlockContent extends ContentEntityBase implements BlockContentInterface {
-
-  use EntityChangedTrait;
+class BlockContent extends EditorialContentEntityBase implements BlockContentInterface {
 
   /**
    * The theme the block is being created in.
@@ -174,6 +172,8 @@
     $fields['type']->setLabel(t('Block type'))
       ->setDescription(t('The block type.'));
 
+    $fields['revision_log']->setDescription(t('The log entry explaining the changes in this revision.'));
+
     $fields['info'] = BaseFieldDefinition::create('string')
       ->setLabel(t('Block description'))
       ->setDescription(t('A brief description of your block.'))
@@ -187,35 +187,12 @@
       ->setDisplayConfigurable('form', TRUE)
       ->addConstraint('UniqueField', []);
 
-    $fields['revision_log'] = BaseFieldDefinition::create('string_long')
-      ->setLabel(t('Revision log message'))
-      ->setDescription(t('The log entry explaining the changes in this revision.'))
-      ->setRevisionable(TRUE)
-      ->setDisplayOptions('form', [
-        'type' => 'string_textarea',
-        'weight' => 25,
-        'settings' => [
-          'rows' => 4,
-        ],
-      ]);
-
     $fields['changed'] = BaseFieldDefinition::create('changed')
       ->setLabel(t('Changed'))
       ->setDescription(t('The time that the custom block was last edited.'))
       ->setTranslatable(TRUE)
       ->setRevisionable(TRUE);
 
-    $fields['revision_created'] = BaseFieldDefinition::create('created')
-      ->setLabel(t('Revision create time'))
-      ->setDescription(t('The time that the current revision was created.'))
-      ->setRevisionable(TRUE);
-
-    $fields['revision_user'] = BaseFieldDefinition::create('entity_reference')
-      ->setLabel(t('Revision user'))
-      ->setDescription(t('The user ID of the author of the current revision.'))
-      ->setSetting('target_type', 'user')
-      ->setRevisionable(TRUE);
-
     return $fields;
   }