function comment_update_8600

Configure the comment hostname base field to use a default value callback.

File

core/modules/comment/comment.install, line 229

Code

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.