Mercurial > hg > isophonics-drupal-site
diff core/modules/comment/comment.install @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
line wrap: on
line diff
--- a/core/modules/comment/comment.install Tue Jul 10 15:07:59 2018 +0100 +++ b/core/modules/comment/comment.install Thu Feb 28 13:21:36 2019 +0000 @@ -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 @@ $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); +}