function _opigno_moxtra_get_workspace_id in Opigno Moxtra 8
Same name and namespace in other branches
- 3.x 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 85 - 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;
}