You are here

public function TableConfigForm::validateForm in Data 8

Form validation handler.

Parameters

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

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormBase::validateForm

File

src/Form/TableConfigForm.php, line 95

Class

TableConfigForm
Class TableConfigForm.

Namespace

Drupal\data\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if ($this->entity
    ->isNew() && $this->entity
    ->exists()) {
    $form_state
      ->setErrorByName('id', t('Table @name already exists.', array(
      '@name' => $this->entity
        ->id(),
    )));
  }
  parent::validateForm($form, $form_state);
}