public static function CalendarHelper::getDisplayForGranularity in Calendar 8
Get the display that handles a given granularity.
Parameters
\Drupal\views\ViewExecutable $view: The view executable service.
$granularity:
Return value
mixed
1 call to CalendarHelper::getDisplayForGranularity()
- CalendarHelper::getURLForGranularity in src/
CalendarHelper.php - Get the Url object that will link to the view for the given granularity and arguments.
File
- src/
CalendarHelper.php, line 858
Class
- CalendarHelper
- Defines Gregorian Calendar date values.
Namespace
Drupal\calendarCode
public static function getDisplayForGranularity(ViewExecutable $view, $granularity) {
$displays =& drupal_static(__FUNCTION__, []);
$view_name = $view
->id();
if (!array_key_exists($view_name, $displays) || isset($displays[$view
->id()]) && !array_key_exists($granularity, $displays[$view
->id()])) {
$displays[$view_name][$granularity] = NULL;
foreach ($view->displayHandlers
->getConfiguration() as $id => $display) {
$loaded_display = $view->displayHandlers
->get($id);
if (!$loaded_display || !$view->displayHandlers
->get($id)
->isEnabled()) {
continue;
}
if ($display['display_plugin'] != 'feed' && !empty($display['display_options']['path']) && !empty($display['display_options']['arguments'])) {
// Set to the default value, reset below if another value is found.
$argument = static::getDateArgumentHandler($view, $id);
if ($argument
->getGranularity() == $granularity) {
$displays[$view
->id()][$granularity] = $display['id'];
}
}
}
}
return $displays[$view
->id()][$granularity];
}