You are here

function calendar_plugin_display_block::validate in Calendar 7

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

Display validation.

Overrides views_plugin_display::validate

File

includes/calendar_plugin_display_block.inc, line 25
Views block plugin for the Calendar module.

Class

calendar_plugin_display_block
The plugin that handles a calendar block.

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 period 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;
}