function SystemHooks::modulesUninstalled

Implements hook_modules_uninstalled().

Attributes

#[Hook('modules_uninstalled')]

File

core/modules/system/src/Hook/SystemHooks.php, line 403

Class

SystemHooks
Hook implementations for system.

Namespace

Drupal\system\Hook

Code

public function modulesUninstalled($modules) : void {
  // @todo Remove this when modules are able to maintain their revision metadata
  //   keys.
  //   @see https://www.drupal.org/project/drupal/issues/3074333
  if (!in_array('workspaces', $modules, TRUE)) {
    return;
  }
  $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  foreach ($entity_definition_update_manager->getEntityTypes() as $entity_type) {
    if ($entity_type instanceof ContentEntityTypeInterface && $entity_type->hasRevisionMetadataKey('workspace')) {
      $entity_type->setRevisionMetadataKey('workspace', NULL);
      $entity_definition_update_manager->updateEntityType($entity_type);
    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.