Mercurial > hg > cmmr2012-drupal-site
diff core/modules/comment/comment.install @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children | 12f9dff5fda9 |
line wrap: on
line diff
--- a/core/modules/comment/comment.install Thu Feb 28 11:14:44 2019 +0000 +++ b/core/modules/comment/comment.install Thu Feb 28 13:11:55 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); +}