You are here

public static function YamlFormRoles::validateYamlFormRoles in YAML Form 8

Form element validation handler for yamlform_users elements.

File

src/Element/YamlFormRoles.php, line 47

Class

YamlFormRoles
Provides a roles entity reference form element.

Namespace

Drupal\yamlform\Element

Code

public static function validateYamlFormRoles(array &$element, FormStateInterface $form_state, array &$complete_form) {
  $value = $form_state
    ->getValue($element['#parents'], []);
  $form_state
    ->setValueForElement($element, array_values(array_filter($value)));
}