public function BBBMeetingTypeController::attend in BigBlueButton 8
Redirect to big blue button instance; Menu callback
Parameters
\Drupal\node\NodeInterface|int $node: A Drupal node Interface
Return value
\Symfony\Component\HttpFoundation\Response|array Render array.
1 string reference to 'BBBMeetingTypeController::attend'
- bbb_node.routing.yml in modules/
bbb_node/ bbb_node.routing.yml - modules/bbb_node/bbb_node.routing.yml
File
- modules/
bbb_node/ src/ Controller/ BBBMeetingTypeController.php, line 105
Class
- BBBMeetingTypeController
- Class BBBMeetingTypeController.
Namespace
Drupal\bbb_node\ControllerCode
public function attend(NodeInterface $node) {
if (is_numeric($node)) {
$node = $this->nodeStorage
->load($node);
}
$node_type = $node
->getType();
$meeting_settings = $this->entityTypeManager
->getStorage('bbb_node_type')
->load($node_type);
$mode = 'attend';
$meeting = $this->nodeMeeting
->get($node);
$params = [
'meetingID' => $meeting->meetingID,
'password' => $meeting->attendeePW,
];
$status = $this->api
->getMeetingInfo($params);
if ($status && property_exists($status, 'hasBeenForciblyEnded') && $status
->hasBeenForciblyEnded() == 'true') {
$this->messenger
->addWarning('The meeting has been terminated and is not available for attending.');
return new RedirectResponse(Url::fromRoute('entity.node.canonical', [
'node' => $node
->id(),
], [
'absolute' => TRUE,
]));
}
// drupal_set_title($node->getTitle());
if ($meeting->running) {
if ($this
->getDisplayMode() === 'blank') {
$this
->redirect($node, $mode);
}
}
else {
if ($meeting_settings
->get('moderatorRequired')) {
$this->messenger
->addStatus($this
->t('You signed up for this meeting. Please stay on this page, you will be redirected immediately after the meeting has started.'));
$render = $this->entityTypeManager
->getViewBuilder('node')
->view($node);
$render['#attached']['libraries'][] = 'bbb/check_status';
$render['#attached']['drupalSettings']['bbb']['check_status']['check_status_url'] = Url::fromRoute('bbb_node.meeting.end_status', [
'node' => $node
->id(),
]);
return $render;
}
else {
if (empty($meeting->initialized)) {
if ($data = $this->nodeMeeting
->create($node, $params)) {
// Update local data.
$this->nodeMeeting
->update($node, array_merge((array) $meeting, (array) $data));
}
}
if ($this
->getDisplayMode() == 'blank') {
$this
->redirect($node, $mode);
}
}
}
return [
'#theme' => 'bbb_meeting',
'#meeting' => $meeting,
'#mode' => $mode,
'#height' => $this
->getDisplayHeight(),
'#width' => $this
->getDisplayWidth(),
];
}