You are here

public function WorkflowTypeForm::validateForm in Workflow 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/WorkflowTypeForm.php, line 262

Class

WorkflowTypeForm
Provides the base form for workflow add and edit forms.

Namespace

Drupal\workflow\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $workflow = $this->entity;
  $name = $workflow
    ->id();

  // Make sure workflow name is not numeric.
  // @todo D8: this was a prerequisite in D7. Remove in D8?
  if (ctype_digit($name)) {
    $form_state
      ->setErrorByName('id', $this
      ->t('Please choose a non-numeric name for your workflow.'));
  }
  parent::validateForm($form, $form_state);
}