function view::validate

3.x view.inc view::validate()
2.x view.inc view::validate()

Make sure the view is completely valid.

Return value

TRUE if the view is valid; an array of error strings if it is not.

File

includes/view.inc, line 1651
view.inc Provides the view object type and associated methods.

Class

view
An object to contain all of the data to generate a view, plus the member functions to build the view query, execute the query and render the output.

Code

function validate() {
  $this->init_display();

  $errors = array();

  $current_display = $this->current_display;
  foreach ($this->display as $id => $display) {
    if ($display->handler) {
      if (!empty($display->deleted)) {
        continue;
      }
      $this->set_display($id);

      $result = $this->display[$id]->handler->validate();
      if (!empty($result) && is_array($result)) {
        $errors = array_merge($errors, $result);
      }
    }
  }

  $this->set_display($current_display);
  return $errors ? $errors : TRUE;
}