protected function Calendar::viewOptionsForGranularity in Calendar 8
Get options for Views displays that support Calendar with set granularity.
Parameters
mixed $granularity: Set Granularity Option.
Return value
array An array with information of the option for the Views displays.
1 call to Calendar::viewOptionsForGranularity()
- Calendar::buildOptionsForm in src/
Plugin/ views/ style/ Calendar.php - Provide a form to edit options for this plugin.
File
- src/
Plugin/ views/ style/ Calendar.php, line 1452
Class
- Calendar
- Views style plugin for the Calendar module.
Namespace
Drupal\calendar\Plugin\views\styleCode
protected function viewOptionsForGranularity($granularity) {
$options = [];
$view_displays = Views::getApplicableViews('uses_route');
foreach ($view_displays as $view_display) {
list($view_id, $display_id) = $view_display;
$view = View::load($view_id);
$view_exec = $view
->getExecutable();
if ($argument = CalendarHelper::getDateArgumentHandler($view_exec, $display_id)) {
if ($argument
->getGranularity() == $granularity) {
$route_name = CalendarHelper::getDisplayRouteName($view_id, $display_id);
$options[$route_name] = $view
->label() . ' : ' . $view_exec->displayHandlers
->get($display_id)->display['display_title'];
}
}
}
return $options;
}