Same name and namespace in other branches
  1. 8.9.x core/modules/workspaces/workspaces.install \workspaces_module_preinstall()
  2. 9 core/modules/workspaces/workspaces.install \workspaces_module_preinstall()

Implements hook_module_preinstall().

File

core/modules/workspaces/workspaces.install, line 33
Contains install, update and uninstall functions for the Workspaces module.

Code

function workspaces_module_preinstall($module) {
  if ($module !== 'workspaces') {
    return;
  }

  /** @var \Drupal\workspaces\WorkspaceInformationInterface $workspace_info */
  $workspace_info = \Drupal::service('workspaces.information');
  $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  foreach ($entity_definition_update_manager
    ->getEntityTypes() as $entity_type) {
    if ($workspace_info
      ->isEntityTypeSupported($entity_type)) {
      $entity_type
        ->setRevisionMetadataKey('workspace', 'workspace');
      $entity_definition_update_manager
        ->updateEntityType($entity_type);
    }
  }
}