X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcomment%2Fcomment.install;h=82b578b48956d0bddb02517b5b0e6b58c8061b7a;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=c244fe4ce8b9dfb1be00cd22b5fc8a79f6b86823;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website diff --git a/web/core/modules/comment/comment.install b/web/core/modules/comment/comment.install index c244fe4ce..82b578b48 100644 --- a/web/core/modules/comment/comment.install +++ b/web/core/modules/comment/comment.install @@ -5,6 +5,7 @@ * Install, update and uninstall functions for the Comment module. */ +use Drupal\comment\Entity\Comment; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\StringTranslation\PluralTranslatableMarkup; use Drupal\Core\StringTranslation\TranslatableMarkup; @@ -195,3 +196,14 @@ function comment_update_8400() { $entity_definition_update_manager = \Drupal::service('entity.definition_update_manager'); $entity_definition_update_manager->updateFieldStorageDefinition($entity_definition_update_manager->getFieldStorageDefinition('status', 'comment')); } + +/** + * Configure the comment hostname base field to use a default value callback. + */ +function comment_update_8600() { + $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager(); + /** @var \Drupal\Core\Field\BaseFieldDefinition $field_storage_definition */ + $field_storage_definition = $entity_definition_update_manager->getFieldStorageDefinition('hostname', 'comment'); + $field_storage_definition->setDefaultValueCallback(Comment::class . '::getDefaultHostname'); + $entity_definition_update_manager->updateFieldStorageDefinition($field_storage_definition); +}