public function LearningPathController::trainingContentWorkspace in Opigno Learning path 3.x
Training workspaces block.
@opigno_deprecated
File
- src/
Controller/ LearningPathController.php, line 488
Class
- LearningPathController
- Class LearningPathController.
Namespace
Drupal\opigno_learning_path\ControllerCode
public function trainingContentWorkspace(&$content, $group, $user) {
// @todo Refactoring needed, the opigno_moxtra.workspace_controller is not available in the code,
// probably should be changed to a opigno_moxtra.meeting_controller service.
$is_moxtra_enabled = \Drupal::hasService('opigno_moxtra.workspace_controller');
if ($is_moxtra_enabled) {
$has_workspace_field = $group
->hasField('field_workspace');
$has_workspace_access = $user
->hasPermission('view workspace entities');
if ($has_workspace_field && $has_workspace_access) {
if ($group
->get('field_workspace')
->getValue() && ($workspace_id = $group
->get('field_workspace')
->getValue()[0]['target_id'])) {
$workspace_url = Url::fromRoute('opigno_moxtra.workspace.iframe', [
'opigno_moxtra_workspace' => $workspace_id,
])
->toString();
$content['tabs'][] = [
'#markup' => '<a class="lp_tabs_link" data-toggle="tab" href="#collaborative-workspace">' . $this
->t('Collaborative Workspace') . '</a>',
];
}
$workspace_tab = [
'#type' => 'container',
'#attributes' => [
'id' => 'collaborative-workspace',
'class' => [
'tab-pane',
'fade',
],
],
'content' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'row',
],
],
isset($workspace_url) ? [
'#type' => 'html_tag',
'#tag' => 'iframe',
'#attributes' => [
'src' => $workspace_url,
'frameborder' => 0,
'width' => '100%',
'height' => '600px',
],
] : [],
],
];
$content['tab_content'][] = $workspace_tab;
}
}
}