You are here

public static function Registrants::validateIdentityElement in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/Element/Registrants.php \Drupal\rng\Element\Registrants::validateIdentityElement()
  2. 8 src/Element/Registrants.php \Drupal\rng\Element\Registrants::validateIdentityElement()

Generic validator for the element.

File

src/Element/Registrants.php, line 689

Class

Registrants
Provides a form element for a registrant and person association.

Namespace

Drupal\rng\Element

Code

public static function validateIdentityElement(&$element, FormStateInterface $form_state, &$complete_form) {
  $utility = new RegistrantsElement($element, $form_state);
  $registrants = $element['#value'];

  // Store original form submission in temporary values.
  $values = $form_state
    ->getValue($element['#parents']);
  $form_state
    ->setTemporaryValue(array_merge([
    '_registrants_values',
  ], $element['#parents']), $values);

  // Change element value to registrant entities.
  $form_state
    ->setValueForElement($element, $registrants);
}