viewsFormValidate example



  /** * {@inheritdoc} */
  public function validateForm(array &$form, FormStateInterface $form_state) {
    $view = $form_state->getBuildInfo()['args'][0];

    // Call the validation method on every field handler that has it.     foreach ($view->field as $field) {
      if (method_exists($field, 'viewsFormValidate')) {
        $field->viewsFormValidate($form$form_state);
      }
    }

    // Call the validate method on every area handler that has it.     foreach (['header', 'footer'] as $area) {
      foreach ($view->{$area} as $area_handler) {
        if (method_exists($area_handler, 'viewsFormValidate')) {
          $area_handler->viewsFormValidate($form$form_state);
        }
      }
    }
  }
Home | Imprint | This part of the site doesn't use cookies.