You are here

public function FullCalendar::validate in FullCalendar 8.4

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

Validate that the plugin is correct and can be saved.

Return value

An array of error strings to tell the user what is wrong with this plugin.

Overrides StylePluginBase::validate

File

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

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

public function validate() {
  $settings = $this
    ->prepareSettings();
  if ($this->displayHandler->display['display_plugin'] != 'default' && !$this
    ->parseFields() && empty($settings['google']['googleCalendarApiKey'])) {
    $this->messenger
      ->deleteAll();
    $this->messenger
      ->addWarning($this
      ->t('Display "@display" requires at least one date field unless you are displaying data from a Google Calendar.', [
      '@display' => $this->displayHandler->display['display_title'],
    ]), 'error');
  }
  return parent::validate();
}