protected function availability_calendar_handler_filter_availability::get_date_popup_options in Availability Calendars 7.5
Returns an array of options for the date (range) picker.
Return value
array
1 call to availability_calendar_handler_filter_availability::get_date_popup_options()
- availability_calendar_handler_filter_availability::change_element_into_date_popup in views/
availability_calendar_handler_filter_availability.inc - Changes a (text) form element into a date popup element.
File
- views/
availability_calendar_handler_filter_availability.inc, line 296
Class
- availability_calendar_handler_filter_availability
- Views handler to filter on availability.
Code
protected function get_date_popup_options() {
$field_info = availability_calendar_get_field_instance_info($this->real_field);
$show_number_of_months = NULL;
$show_week_number = FALSE;
$first_day_of_week = NULL;
foreach ($field_info['bundles'] as $entity_type => $bundles) {
foreach ($bundles as $bundle => $field_instance_info) {
$settings = $field_instance_info['display']['default']['settings'];
if (isset($settings['show_number_of_months'])) {
$show_number_of_months = $show_number_of_months === NULL ? $settings['show_number_of_months'] : min($show_number_of_months, (int) $settings['show_number_of_months']);
}
if (isset($settings['first_day_of_week'])) {
if ($first_day_of_week !== FALSE) {
if ($first_day_of_week === NULL) {
$first_day_of_week = (int) $settings['first_day_of_week'];
}
else {
if ($first_day_of_week != (int) $settings['first_day_of_week']) {
$first_day_of_week = FALSE;
}
}
}
}
if (isset($settings['show_week_number'])) {
$show_week_number = $show_week_number || (bool) $settings['show_week_number'];
}
}
}
if ($first_day_of_week === NULL | $first_day_of_week === FALSE) {
$first_day_of_week = variable_get('date_first_day', 6);
}
return array(
'firstDay' => $first_day_of_week,
'minDate' => 0,
'maxDate' => sprintf('+%dm', $show_number_of_months),
'showWeek' => $show_week_number,
);
}