I'm building a booking calendar module, and want to get back arrival & departure datefields values to highlight reservations on the calendar, passing to a library the variables.
public function showCalendarAction() {
return [
'#attached'=> ['library'=> ['my_booking_calendar/my_booking_calendar.popperjs']],
'#attached'=> ['library'=> ['my_booking_calendar/my_booking_calendar.bootstrap']],
'#attached'=> ['library'=> ['my_booking_calendar/my_booking_calendar.bootstrap_year_calendar']],
'#markup'=>$this->t('<div data-provide="calendar"></div>')
];
}
I intended to store all the dates(linked to one hotel/house) in a json file, that I would call in ajax.
If it's a good Drupal 8 practice, how to do this ?
Else, what would be the good way to store and pass the variables to my module library ?