function bibcite_entity_update_8016 in Bibliography & Citation 8
Same name and namespace in other branches
- 2.0.x modules/bibcite_entity/bibcite_entity.install \bibcite_entity_update_8016()
Force Revision user field storage definition update to fix "The Revision user field needs to be updated" error on Status report, which means that entity and field definitions became mismatched for some reason after making Reference entity type revisionable.
File
- modules/
bibcite_entity/ bibcite_entity.install, line 675 - Module installation hooks implementation.
Code
function bibcite_entity_update_8016() {
$definition_update_manager = \Drupal::entityDefinitionUpdateManager();
$entity_type = $definition_update_manager
->getEntityType('bibcite_reference');
$entity_type_id = $entity_type
->id();
$revision_user = BaseFieldDefinition::create('entity_reference')
->setName('revision_user')
->setTargetEntityTypeId($entity_type_id)
->setTargetBundle(NULL)
->setLabel(t('Revision user'))
->setDescription(t('The user ID of the author of the current revision.'))
->setSetting('target_type', 'user')
->setRevisionable(TRUE);
$definition_update_manager
->updateFieldStorageDefinition($revision_user);
}