You are here

function opigno_moxtra_opigno_moxtra_workspace_update in Opigno Moxtra 8

Same name and namespace in other branches
  1. 3.x opigno_moxtra.module \opigno_moxtra_opigno_moxtra_workspace_update()

Implements hook_ENTITY_TYPE_update().

Updates collaborative workspace info in the Moxtra.

File

./opigno_moxtra.module, line 643
Contains opigno_moxtra.module.

Code

function opigno_moxtra_opigno_moxtra_workspace_update(EntityInterface $entity) {

  /** @var \Drupal\opigno_moxtra\WorkspaceInterface $entity */
  if ($entity
    ->label() !== $entity->original
    ->label()) {
    $binder_id = $entity
      ->getBinderId();
    if (!empty($binder_id)) {
      $moxtra_api = _opigno_moxtra_get_moxtra_api();
      $owner_id = $entity
        ->getOwnerId();
      $name = $entity
        ->label();
      $moxtra_api
        ->updateWorkspace($owner_id, $binder_id, $name);
    }
  }
}