comparison 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
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
3 /** 3 /**
4 * @file 4 * @file
5 * Install, update and uninstall functions for the Comment module. 5 * Install, update and uninstall functions for the Comment module.
6 */ 6 */
7 7
8 use Drupal\comment\Entity\Comment;
8 use Drupal\Core\Entity\EntityTypeInterface; 9 use Drupal\Core\Entity\EntityTypeInterface;
9 use Drupal\Core\StringTranslation\PluralTranslatableMarkup; 10 use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
10 use Drupal\Core\StringTranslation\TranslatableMarkup; 11 use Drupal\Core\StringTranslation\TranslatableMarkup;
11 use Drupal\field\Entity\FieldStorageConfig; 12 use Drupal\field\Entity\FieldStorageConfig;
12 13
193 // which makes it NOT NULL in the default SQL storage, which means its storage 194 // which makes it NOT NULL in the default SQL storage, which means its storage
194 // definition needs to be updated as well. 195 // definition needs to be updated as well.
195 $entity_definition_update_manager = \Drupal::service('entity.definition_update_manager'); 196 $entity_definition_update_manager = \Drupal::service('entity.definition_update_manager');
196 $entity_definition_update_manager->updateFieldStorageDefinition($entity_definition_update_manager->getFieldStorageDefinition('status', 'comment')); 197 $entity_definition_update_manager->updateFieldStorageDefinition($entity_definition_update_manager->getFieldStorageDefinition('status', 'comment'));
197 } 198 }
199
200 /**
201 * Configure the comment hostname base field to use a default value callback.
202 */
203 function comment_update_8600() {
204 $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
205 /** @var \Drupal\Core\Field\BaseFieldDefinition $field_storage_definition */
206 $field_storage_definition = $entity_definition_update_manager->getFieldStorageDefinition('hostname', 'comment');
207 $field_storage_definition->setDefaultValueCallback(Comment::class . '::getDefaultHostname');
208 $entity_definition_update_manager->updateFieldStorageDefinition($field_storage_definition);
209 }