You are here

public static function NameFieldSettingsTrait::validateGenerationalOptions in Name Field 8

Helper function to validate minimum components.

Parameters

array $element: Element being validated.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

File

src/Traits/NameFieldSettingsTrait.php, line 388

Class

NameFieldSettingsTrait
Name settings trait.

Namespace

Drupal\name\Traits

Code

public static function validateGenerationalOptions($element, FormStateInterface $form_state) {
  $values = static::extractAllowedValues($element['#value']);
  $max_length_keys = [
    'settings',
    'max_length',
    'generational',
  ];
  $max_length = $form_state
    ->getValue($max_length_keys);
  static::validateOptions($element, $form_state, $values, $max_length);
}