You are here

function _opigno_moxtra_get_workspace_id in Opigno Moxtra 3.x

Same name and namespace in other branches
  1. 8 opigno_moxtra.module \_opigno_moxtra_get_workspace_id()

Returns the workspace ID of the training group.

Parameters

\Drupal\group\Entity\GroupInterface $group: Training group.

Return value

int|null Workspace ID.

1 call to _opigno_moxtra_get_workspace_id()
_opigno_moxtra_get_workspace in ./opigno_moxtra.module
Returns the workspace of the training group.

File

./opigno_moxtra.module, line 87
Contains opigno_moxtra.module.

Code

function _opigno_moxtra_get_workspace_id(GroupInterface $group) {
  if ($group
    ->hasField('field_workspace')) {
    $value = $group
      ->get('field_workspace')
      ->getValue();
    if (!empty($value)) {
      return $value[0]['target_id'];
    }
  }
  return NULL;
}