function bat_fullcalendar_bat_fullcalendar_modal_content in Booking and Availability Management Tools for Drupal 8
Same name and namespace in other branches
- 7 modules/bat_fullcalendar/bat_fullcalendar.module \bat_fullcalendar_bat_fullcalendar_modal_content()
Implements hook_bat_fullcalendar_modal_content();
File
- modules/
bat_fullcalendar/ bat_fullcalendar.module, line 18 - Manages the display of FullCalendar and provides ways for other modules to easily modify it.
Code
function bat_fullcalendar_bat_fullcalendar_modal_content($entity_id, $event_type, $event_id, $start_date, $end_date) {
if ($event_id > 0) {
$event = bat_event_load($event_id);
$event_form = (new EventController(\Drupal::request()))
->editEvent($event);
$event_form['#attached']['library'][] = 'core/drupal.ajax';
$event_form['#attached']['library'][] = 'core/jquery.form';
if (isset($event_form['#validated']) && $event_form['#validated']) {
return [
'bat_fullcalendar' => [
'commands' => [
new CloseModalDialogCommand(),
],
],
];
}
else {
return [
'bat_fullcalendar' => [
'title' => t('Edit event'),
'content' => $event_form,
],
];
}
}
else {
return [
'bat_fullcalendar' => [
'title' => t('Event Management'),
'content' => \Drupal::formBuilder()
->getForm('Drupal\\bat_fullcalendar\\Form\\FullcalendarEventManagerForm', $entity_id, $event_type, $event_id, $start_date, $end_date),
],
];
}
}