You are here

protected function FullCalendar::prepareSettings in FullCalendar 8.5

Same name and namespace in other branches
  1. 8 src/Plugin/views/style/FullCalendar.php \Drupal\fullcalendar\Plugin\views\style\FullCalendar::prepareSettings()
  2. 8.2 src/Plugin/views/style/FullCalendar.php \Drupal\fullcalendar\Plugin\views\style\FullCalendar::prepareSettings()
  3. 8.3 src/Plugin/views/style/FullCalendar.php \Drupal\fullcalendar\Plugin\views\style\FullCalendar::prepareSettings()
  4. 8.4 src/Plugin/views/style/FullCalendar.php \Drupal\fullcalendar\Plugin\views\style\FullCalendar::prepareSettings()

Prepare JavaScript settings.

Throws

\Exception

2 calls to FullCalendar::prepareSettings()
FullCalendar::prepareAttached in src/Plugin/views/style/FullCalendar.php
Load libraries.
FullCalendar::validate in src/Plugin/views/style/FullCalendar.php
Validate that the plugin is correct and can be saved.

File

src/Plugin/views/style/FullCalendar.php, line 264

Class

FullCalendar
Plugin annotation @ViewsStyle( id = "fullcalendar", title = @Translation("FullCalendar"), help = @Translation("Displays items on a calendar."), theme = "views_view--fullcalendar", display_types = {"normal"} )

Namespace

Drupal\fullcalendar\Plugin\views\style

Code

protected function prepareSettings() {
  $settings =& drupal_static(__METHOD__, []);
  if (empty($settings)) {

    /* @var \Drupal\fullcalendar\Plugin\fullcalendar\type\FullCalendar $plugin */
    foreach ($this
      ->getPlugins() as $plugin_id => $plugin) {
      $plugin
        ->process($settings);
    }
  }

  // Google Calendar events.
  if (!empty($settings['options']['googleCalendarApiKey'])) {
    $ids = array_map('trim', explode(',', trim($settings['googleCalendarId'])));
    foreach ($ids as $id) {
      $settings['options']['eventSources'][] = [
        'googleCalendarId' => $id,
        'className' => 'fc-event-default',
      ];
    }
  }

  // Drupal events.
  $events = $this
    ->prepareEvents();
  if ($events) {
    $settings['options']['eventSources'][] = $events;
  }
  return $settings;
}