You are here

public function Calendar::validate in Calendar 8

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/Calendar.php, line 1427

Class

Calendar
Views style plugin for the Calendar module.

Namespace

Drupal\calendar\Plugin\views\style

Code

public function validate() {
  $errors = parent::validate();
  $display_id = $this->displayHandler->display['id'];
  if ($display_id == 'default') {

    // @todo Update default display in templates to validate.
    return $errors;
  }

  // @todo Validate row plugin
  $argument = CalendarHelper::getDateArgumentHandler($this->view, $display_id);
  if (empty($argument)) {
    $errors[] = $this
      ->t('\\Drupal\\calendar\\Plugin\\views\\style\\CalendarStyle: A calendar date argument is required when using the calendar style, to add a date argument in a view, please go to Advanced > Contextual Filters on the views configuration panel.');
  }
  return $errors;
}