You are here

public function NodeOrderListBuilder::validateForm in Node Order 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 FormInterface::validateForm

File

src/NodeOrderListBuilder.php, line 259

Class

NodeOrderListBuilder
Defines a class to build a listing of node entities.

Namespace

Drupal\nodeorder

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (empty($form_state
    ->getValue('term_id'))) {
    $form_state
      ->setError($form, $this
      ->t('Term ID required.'));
  }
  if (empty($form_state
    ->getValue($this->entitiesKey))) {
    $form_state
      ->setErrorByName($this->entitiesKey, $this
      ->t('There are no nodes attached to current term.'));
  }
}