Same name and namespace in other branches
  1. 6.x-3.x includes/view.inc \view::validate()

Make sure the view is completely valid.

Return value

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

File

includes/view.inc, line 2119
views_objects Objects that represent a View or part of a view

Class

view

Code

public function validate() {
  $this
    ->init_display();
  $errors = array();
  $this->display_errors = NULL;
  $current_display = $this->current_display;
  foreach ($this->display as $id => $display) {
    if ($display->handler) {
      if (!empty($display->deleted)) {
        continue;
      }
      $result = $this->display[$id]->handler
        ->validate();
      if (!empty($result) && is_array($result)) {
        $errors = array_merge($errors, $result);

        // Mark this display as having validation errors.
        $this->display_errors[$id] = TRUE;
      }
    }
  }
  $this
    ->set_display($current_display);
  return $errors ? $errors : TRUE;
}