function webform_revisions_8000 in Config Entity Revisions 8.2
Same name and namespace in other branches
- 8 modules/webform_revisions/webform_revisions.install \webform_revisions_8000()
- 1.x modules/webform_revisions/webform_revisions.install \webform_revisions_8000()
Implements hook_update().
File
- modules/
webform_revisions/ webform_revisions.install, line 46 - Install and update hooks for webform_revisions.
Code
function webform_revisions_8000(&$sandbox) {
// Add a reference from a webform submission to the matching config entity
// revision.
$storage_definition = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Webform revision'))
->setTargetEntityTypeId('config_entity_revisions')
->setTargetBundle(NULL);
\Drupal::entityDefinitionUpdateManager()
->uninstallFieldStorageDefinition('webform_revision', 'webform_submission', 'webform_revisions', $storage_definition);
$entityTypeManager = \Drupal::entityTypeManager();
$cert_storage = $entityTypeManager
->getStorage('config_entity_revisions_type');
$entity = $cert_storage
->create([
'id' => 'webform_revisions',
]);
$entity
->save();
}