You are here

public function EntityformTypeForm::validate in Entityform 8.3

File

src/EntityformTypeForm.php, line 186
Contains \Drupal\entityform\EntityformTypeFormController.

Class

EntityformTypeForm
Form controller for entityform type forms.

Namespace

Drupal\entityform

Code

public function validate(array $form, FormStateInterface $form_state) {
  parent::validate($form, $form_state);
  $id = trim($form_state
    ->getValue('type'));

  // '0' is invalid, since elsewhere we check it using empty().
  if ($id == '0') {
    $form_state
      ->setErrorByName('type', $this
      ->t("Invalid machine-readable name. Enter a name other than %invalid.", array(
      '%invalid' => $id,
    )));
  }
}