You are here

public function MaestroTemplateFormBase::validateForm in Maestro 3.x

Same name and namespace in other branches
  1. 8.2 src/Form/MaestroTemplateFormBase.php \Drupal\maestro\Form\MaestroTemplateFormBase::validateForm()

Overrides Drupal\Core\Entity\EntityFormController::validate().

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The form's form state.

Overrides FormBase::validateForm

File

src/Form/MaestroTemplateFormBase.php, line 395

Class

MaestroTemplateFormBase
Class MaestroTemplateFormBase.

Namespace

Drupal\maestro\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  if ($form_state
    ->getValue('add_view') && $form_state
    ->getValue('add_view') != '') {
    $view = Views::getView($form_state
      ->getValue('add_view'));
    if (!$view) {
      $form_state
        ->setErrorByName('add_view', $this
        ->t('An invalid view was entered'));
    }
  }
}