diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index b4fd6aa..b3124d0 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -6,6 +6,7 @@ */ use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\StringTranslation\PluralTranslatableMarkup; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\field\Entity\FieldStorageConfig; @@ -179,3 +180,18 @@ function comment_update_8200() { /** * @} End of "addtogroup updates-8.2.x". */ + +/** + * Switch status from boolean to integer. + */ +function comment_update_8300() { + $manager = \Drupal::entityDefinitionUpdateManager(); + $definition = BaseFieldDefinition::create('status') + ->setName('status') + ->setTargetEntityTypeId('comment') + ->setLabel(t('Publishing status')) + ->setDescription(t('An integer indicating the comment status.')) + ->setTranslatable(TRUE) + ->setDefaultValue(1); + $manager->updateFieldStorageDefinition($definition); +} \ No newline at end of file diff --git a/core/modules/comment/src/Entity/Comment.php b/core/modules/comment/src/Entity/Comment.php index d626be3..fe1d641 100644 --- a/core/modules/comment/src/Entity/Comment.php +++ b/core/modules/comment/src/Entity/Comment.php @@ -285,11 +285,11 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ->setDescription(t('The time that the comment was last edited.')) ->setTranslatable(TRUE); - $fields['status'] = BaseFieldDefinition::create('boolean') + $fields['status'] = BaseFieldDefinition::create('status') ->setLabel(t('Publishing status')) - ->setDescription(t('A boolean indicating whether the comment is published.')) + ->setDescription(t('An integer indicating the comment status.')) ->setTranslatable(TRUE) - ->setDefaultValue(TRUE); + ->setDefaultValue(1); $fields['thread'] = BaseFieldDefinition::create('string') ->setLabel(t('Thread place')) diff --git a/core/modules/node/node.install b/core/modules/node/node.install index c754880..191039c 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -218,3 +218,19 @@ function node_update_8003() { $manager->updateFieldStorageDefinition($manager->getFieldStorageDefinition($field_name, 'node')); } } + +/** + * Switch status from boolean to integer. + */ +function node_update_8004() { + $manager = \Drupal::entityDefinitionUpdateManager(); + $definition = BaseFieldDefinition::create('status') + ->setName('status') + ->setTargetEntityTypeId('node') + ->setLabel(t('Publishing status')) + ->setDescription(t('A integer indicating the node status.')) + ->setRevisionable(TRUE) + ->setTranslatable(TRUE) + ->setDefaultValue(1); + $manager->updateFieldStorageDefinition($definition); +} diff --git a/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php index bdb8050..e4555d4 100644 --- a/core/modules/node/src/Entity/Node.php +++ b/core/modules/node/src/Entity/Node.php @@ -408,12 +408,12 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { )) ->setDisplayConfigurable('form', TRUE); - $fields['status'] = BaseFieldDefinition::create('boolean') + $fields['status'] = BaseFieldDefinition::create('status') ->setLabel(t('Publishing status')) - ->setDescription(t('A boolean indicating whether the node is published.')) + ->setDescription(t('A integer indicating the node status.')) ->setRevisionable(TRUE) ->setTranslatable(TRUE) - ->setDefaultValue(TRUE); + ->setDefaultValue(1); $fields['created'] = BaseFieldDefinition::create('created') ->setLabel(t('Authored on'))