function bbb_node_form_node_form_alter in BigBlueButton 8
Implements hook_form_BASE_FORM_ID_alter().
File
- modules/
bbb_node/ bbb_node.module, line 141 - Big Blue Button - Enables universities and colleges to deliver a high-quality learning experience.
Code
function bbb_node_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
/** @var \Drupal\bbb_node\Service\NodeMeeting $node_meeting */
$node_meeting = \Drupal::service('bbb_node.meeting');
/** @var \Drupal\node\NodeInterface $node */
$node = $form_state
->getFormObject()
->getEntity();
if ($node_meeting
->isTypeOf($node)) {
$meeting = $node_meeting
->get($node);
/** @var \BigBlueButton\Parameters\CreateMeetingParameters $meeting_info */
$meeting_info = !empty($meeting['info']) ? $meeting['info'] : $node_meeting
->init($node);
$form['bbb'] = [];
$record = [
'#title' => t('Record meeting'),
'#type' => 'select',
'#default_value' => $meeting_info
->isRecorded(),
'#options' => [
0 => t('Do not record'),
1 => t('Record'),
],
'#weight' => -1,
];
if (\Drupal::currentUser()
->hasPermission('administer big blue button')) {
$form['bbb']['welcome'] = [
'#title' => t('Welcome message'),
'#type' => 'textfield',
'#default_value' => $meeting_info
->getWelcomeMessage(),
'#maxlength' => 255,
'#description' => t('A welcome message that gets displayed on the chat window when the participant joins. You can include keywords (%%CONFNAME%%, %%DIALNUM%%, %%CONFNUM%%) which will be substituted automatically.'),
];
$form['bbb']['dialNumber'] = [
'#title' => t('Dial number'),
'#type' => 'textfield',
'#default_value' => $meeting_info
->getDialNumber(),
'#maxlength' => 32,
'#description' => t('The dial access number that participants can call in using regular phone.'),
];
$form['bbb']['moderatorPW'] = [
'#title' => t('Moderator password'),
'#type' => 'textfield',
'#default_value' => $meeting_info
->getModeratorPassword(),
'#maxlength' => 32,
'#description' => t('The password that will be required for moderators to join the meeting or for certain administrative actions (i.e. ending a meeting).'),
];
$form['bbb']['attendeePW'] = [
'#title' => t('Attendee password'),
'#type' => 'textfield',
'#default_value' => $meeting_info
->getAttendeePassword(),
'#maxlength' => 32,
'#description' => t('The password that will be required for attendees to join the meeting.'),
];
$form['bbb']['logoutURL'] = [
'#title' => t('Logout URL'),
'#type' => 'textfield',
'#default_value' => $meeting_info
->getLogoutUrl(),
'#maxlength' => 255,
'#description' => t('The URL that the Big Blue Button client will go to after users click the OK button on the <em>You have been logged out message</em>.'),
];
$form['bbb']['record'] = $record;
}
if (\Drupal::currentUser()
->hasPermission('bbb_node record meetings') && empty($form['bbb']['record'])) {
// this clause is for users who have the record meetings permission but no permissions to "administer BBB"
$form['bbb']['record'] = $record;
}
// Add details block and show if any of form elements added.
$form['bbb'] += [
'#access' => !empty($form['bbb']),
'#title' => t('Meeting settings'),
'#type' => 'details',
'#description' => t("The following settings may be changed until the meeting first starts."),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => TRUE,
'#group' => 'advanced',
'#weight' => 100,
];
}
}