You are here

function multiversion_workspace_update in Multiversion 8

Implements hook_ENTITY_TYPE_update().

File

./multiversion.module, line 283

Code

function multiversion_workspace_update(EntityInterface $entity) {

  /** @var \Drupal\multiversion\Entity\WorkspaceInterface $entity */
  if (!$entity
    ->isPublished() && $entity->original
    ->isPublished()) {
    $default_workspace = \Drupal::getContainer()
      ->getParameter('workspace.default');
    \Drupal::service('workspace.manager')
      ->setActiveWorkspace(Workspace::load($default_workspace));
  }
}