You are here

function calendar_plugin_display_page::validate in Calendar 7.2

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

Display validation.

Overrides views_plugin_display_page::validate

File

includes/calendar_plugin_display_page.inc, line 29
Views page plugin for the Calendar module.

Class

calendar_plugin_display_page
The plugin that handles a full calendar page.

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("The Calendar display '@display_title' will not work without a Date argument.", array(
        '@display_title' => $this->definition['title'],
      ));
    }
    $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;
}