You are here

public static function CalendarHelper::listCalendarViews in Calendar 8

Return a list of all calendar views.

Return value

array A list of all calendar views.

1 call to CalendarHelper::listCalendarViews()
CalendarLegend::blockForm in src/Plugin/Block/CalendarLegend.php
Returns the configuration form elements specific to this block plugin.

File

src/CalendarHelper.php, line 82

Class

CalendarHelper
Defines Gregorian Calendar date values.

Namespace

Drupal\calendar

Code

public static function listCalendarViews() {
  $calendar_views = [];
  $views = Views::getEnabledViews();
  foreach ($views as $view) {
    $ve = $view
      ->getExecutable();
    $ve
      ->initDisplay();
    foreach ($ve->displayHandlers
      ->getConfiguration() as $display_id => $display) {
      if ($display_id != 'default' && ($types = $ve
        ->getStyle()
        ->getPluginId() == 'calendar')) {
        $index = $ve
          ->id() . ':' . $display_id;
        $calendar_views[$index] = ucfirst($ve
          ->id()) . ' ' . strtolower($display['display_title']) . ' [' . $ve
          ->id() . ':' . $display['id'] . ']';
      }
    }
  }
  return $calendar_views;
}