You are here

function calendar_plugin_display_attachment::validate in Calendar 7

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

Display validation.

Overrides views_plugin_display::validate

File

includes/calendar_plugin_display_attachment.inc, line 95
Views display plugin for the Calendar module.

Class

calendar_plugin_display_attachment
The plugin that handles calendar attachment displays.

Code

function validate() {
  $errors = parent::validate();
  $arguments = $this->display->handler
    ->get_option('arguments');
  if (!in_array('date_argument', array_keys($arguments))) {
    if (empty($this->view->date_info->arg_missing)) {
      $errors[] = t("A Calendar period display will not work without a Date argument.");
    }
    $this->view->date_info->arg_missing = TRUE;
  }
  elseif ($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;
}