public static function YamlFormUsers::validateYamlFormUsers in YAML Form 8
Form element validation handler for yamlform_users elements.
File
- src/
Element/ YamlFormUsers.php, line 50
Class
- YamlFormUsers
- Provides a users entity reference form element.
Namespace
Drupal\yamlform\ElementCode
public static function validateYamlFormUsers(array &$element, FormStateInterface $form_state, array &$complete_form) {
$value = $form_state
->getValue($element['#parents'], []);
$uids = [];
if ($value) {
foreach ($value as $item) {
if (isset($item)) {
$uids[] = $item['target_id'];
}
}
}
$form_state
->setValueForElement($element, $uids);
}