function WorkspacesHooks::modulePreinstall

Implements hook_module_preinstall().

File

core/modules/workspaces/src/Hook/WorkspacesHooks.php, line 51

Class

WorkspacesHooks
Hook implementations for workspaces.

Namespace

Drupal\workspaces\Hook

Code

public function modulePreinstall(string $module) : void {
    if ($module !== 'workspaces') {
        return;
    }
    foreach ($this->entityDefinitionUpdateManager
        ->getEntityTypes() as $entity_type) {
        if ($this->workspaceInfo
            ->isEntityTypeSupported($entity_type)) {
            $entity_type->setRevisionMetadataKey('workspace', 'workspace');
            $this->entityDefinitionUpdateManager
                ->updateEntityType($entity_type);
        }
    }
}

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