You are here

public function RelationTypeForm::validate in Relation 8

Same name and namespace in other branches
  1. 8.2 src/RelationTypeForm.php \Drupal\relation\RelationTypeForm::validate()

File

src/RelationTypeForm.php, line 188
Definition of Drupal\relation\RelationTypeForm.

Class

RelationTypeForm
Form controller for relation edit form.

Namespace

Drupal\relation

Code

public function validate(array $form, FormStateInterface $form_state) {
  $min_arity = $form_state
    ->getValue('min_arity');
  $max_arity = $form_state
    ->getValue('max_arity');

  // Empty max arity indicates infinite arity.
  if ($max_arity && $min_arity > $max_arity) {
    $form_state
      ->setErrorByName('min_arity', t('Minimum arity cannot be more than maximum arity.'));
  }
}