Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/comment/comment.install @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
205 /** @var \Drupal\Core\Field\BaseFieldDefinition $field_storage_definition */ | 205 /** @var \Drupal\Core\Field\BaseFieldDefinition $field_storage_definition */ |
206 $field_storage_definition = $entity_definition_update_manager->getFieldStorageDefinition('hostname', 'comment'); | 206 $field_storage_definition = $entity_definition_update_manager->getFieldStorageDefinition('hostname', 'comment'); |
207 $field_storage_definition->setDefaultValueCallback(Comment::class . '::getDefaultHostname'); | 207 $field_storage_definition->setDefaultValueCallback(Comment::class . '::getDefaultHostname'); |
208 $entity_definition_update_manager->updateFieldStorageDefinition($field_storage_definition); | 208 $entity_definition_update_manager->updateFieldStorageDefinition($field_storage_definition); |
209 } | 209 } |
210 | |
211 /** | |
212 * Set the 'owner' entity key and update the field. | |
213 */ | |
214 function comment_update_8700() { | |
215 $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); | |
216 $entity_type = $definition_update_manager->getEntityType('comment'); | |
217 $keys = $entity_type->getKeys(); | |
218 $keys['owner'] = 'uid'; | |
219 $entity_type->set('entity_keys', $keys); | |
220 $definition_update_manager->updateEntityType($entity_type); | |
221 $definition_update_manager->updateFieldStorageDefinition($definition_update_manager->getFieldStorageDefinition('uid', 'comment')); | |
222 } | |
223 | |
224 /** | |
225 * Make the 'entity_type' and 'field_name' comment fields required. | |
226 */ | |
227 function comment_update_8701() { | |
228 $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); | |
229 $field_definition = $definition_update_manager->getFieldStorageDefinition('entity_type', 'comment'); | |
230 $field_definition->setRequired(TRUE); | |
231 $definition_update_manager->updateFieldStorageDefinition($field_definition); | |
232 | |
233 $field_definition = $definition_update_manager->getFieldStorageDefinition('field_name', 'comment'); | |
234 $field_definition->setRequired(TRUE); | |
235 $definition_update_manager->updateFieldStorageDefinition($field_definition); | |
236 } |