function content_moderation_update_8700 in Drupal 8
Set the 'owner' entity key and update the field.
File
- core/
modules/ content_moderation/ content_moderation.install, line 63 - Install, update and uninstall functions for the Content Moderation module.
Code
function content_moderation_update_8700() {
$definition_update_manager = \Drupal::entityDefinitionUpdateManager();
$entity_type = $definition_update_manager
->getEntityType('content_moderation_state');
$keys = $entity_type
->getKeys();
$keys['owner'] = 'uid';
$entity_type
->set('entity_keys', $keys);
$definition_update_manager
->updateEntityType($entity_type);
$definition_update_manager
->updateFieldStorageDefinition($definition_update_manager
->getFieldStorageDefinition('uid', 'content_moderation_state'));
}