You are here

function calendar_plugin_display_ical::validate in Calendar 7

Same name and namespace in other branches
  1. 6.2 calendar_ical/calendar_plugin_display_ical.inc \calendar_plugin_display_ical::validate()
  2. 7.2 calendar_ical/calendar_plugin_display_ical.inc \calendar_plugin_display_ical::validate()

Display validation.

Overrides views_plugin_display_page::validate

File

calendar_ical/calendar_plugin_display_ical.inc, line 207
Views display plugin for the Calendar iCal module.

Class

calendar_plugin_display_ical
The plugin that handles a feed, such as RSS or atom.

Code

function validate() {
  $errors = parent::validate();
  $arguments = $this->display->handler
    ->get_option('arguments');
  $filters = $this->display->handler
    ->get_option('filters');
  if (!array_key_exists('date_argument', $arguments) && !array_key_exists('date_filter', $filters)) {
    if (empty($this->view->date_info->arg_missing)) {
      $errors[] = t("A Calendar period display will not work without a Date argument or a Date filter.");
    }
    $this->view->date_info->arg_missing = TRUE;
  }
  if (array_key_exists('date_argument', $arguments) && ($arguments['date_argument']['default_action'] != 'default' || $arguments['date_argument']['default_argument_type'] != 'date')) {
    if (empty($this->view->date_info->arg_missing_default)) {
      $errors[] = calendar_errors('missing_argument_default');
    }
    $this->view->date_info->arg_missing_default = TRUE;
  }
  return $errors;
}