function comment_update_8701
Make the 'entity_type' and 'field_name' comment fields required.
File
-
core/
modules/ comment/ comment.install, line 253
Code
function comment_update_8701() {
$definition_update_manager = \Drupal::entityDefinitionUpdateManager();
$field_definition = $definition_update_manager->getFieldStorageDefinition('entity_type', 'comment');
$field_definition->setRequired(TRUE);
$definition_update_manager->updateFieldStorageDefinition($field_definition);
$field_definition = $definition_update_manager->getFieldStorageDefinition('field_name', 'comment');
$field_definition->setRequired(TRUE);
$definition_update_manager->updateFieldStorageDefinition($field_definition);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.