public function ViewExecutable::validate

Makes sure the view is completely valid.

Return value

array An array of error strings. This will be empty if there are no validation errors.

File

drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php, line 1726
Definition of Drupal\views\ViewExecutable.

Class

ViewExecutable
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.

Namespace

Drupal\views

Code

public function validate() {
  $errors = array();
  $this
    ->initDisplay();
  $current_display = $this->current_display;
  foreach ($this->displayHandlers as $id => $display) {
    if (!empty($display)) {
      if (!empty($display->display['deleted'])) {
        continue;
      }
      $result = $this->displayHandlers
        ->get($id)
        ->validate();
      if (!empty($result) && is_array($result)) {
        $errors[$id] = $result;
      }
    }
  }
  $this
    ->setDisplay($current_display);
  return $errors;
}