You are here

public function FullCalendar::getEnabledFullcalendarPlugins in FullCalendar 8.2

Same name and namespace in other branches
  1. 8.5 src/Plugin/fullcalendar/type/FullCalendar.php \Drupal\fullcalendar\Plugin\fullcalendar\type\FullCalendar::getEnabledFullcalendarPlugins()
  2. 8.4 src/Plugin/fullcalendar/type/FullCalendar.php \Drupal\fullcalendar\Plugin\fullcalendar\type\FullCalendar::getEnabledFullcalendarPlugins()

Get list of enabled FC plugins.

Parameters

array $settings: Settings for the view.

Return value

array

1 call to FullCalendar::getEnabledFullcalendarPlugins()
FullCalendar::preView in src/Plugin/fullcalendar/type/FullCalendar.php

File

src/Plugin/fullcalendar/type/FullCalendar.php, line 1216

Class

FullCalendar
Plugin annotation @FullcalendarOption( id = "fullcalendar", module = "fullcalendar", js = TRUE, weight = "-20" )

Namespace

Drupal\fullcalendar\Plugin\fullcalendar\type

Code

public function getEnabledFullcalendarPlugins($settings) {
  $plugins = [];
  $form_fields = [
    'month_view' => 'dayGrid',
    'timegrid_view' => 'timeGrid',
    'list_view' => 'list',
    'daygrid_view' => 'dayGrid',
  ];
  foreach ($form_fields as $field => $fcPlugin) {
    if (isset($settings[$field]) && (bool) $settings[$field] === TRUE) {
      $plugins[] = $fcPlugin;
    }
  }
  if (!empty($settings['google']['googleCalendarApiKey'])) {
    $plugins[] = 'googleCalendar';
  }
  return $plugins;
}