You are here

public function EckEntityBundleForm::validate in Entity Construction Kit (ECK) 8

File

src/Form/EntityBundle/EckEntityBundleForm.php, line 183

Class

EckEntityBundleForm
Form controller for ECK entity bundle forms.

Namespace

Drupal\eck\Form\EntityBundle

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.", [
      '%invalid' => $id,
    ]));
  }
}