public function RegistrantsElementUtility::getArity in RNG - Events and Registrations 8
Get form state for for_arity.
File
- src/
RegistrantsElementUtility.php, line 168
Class
Namespace
Drupal\rngCode
public function getArity() {
$arity = $this->formState
->get(array_merge($this->element['#parents'], [
'for_arity',
]));
if ($arity === NULL) {
$values = NestedArray::getValue($this->formState
->getUserInput(), $this->element['#parents']);
if (isset($values['for_arity'])) {
$arity = $values['for_arity'];
}
else {
// Default.
$minimum = $this->element['#registrants_minimum'];
$maximum = $this->element['#registrants_maximum'];
$count = count($this->element['#value']);
if ($minimum && $minimum > 1) {
$arity = 'multiple';
}
else {
if ($maximum && $maximum == 1) {
$arity = 'single';
}
else {
$arity = $count > 1 ? 'multiple' : 'single';
}
}
}
}
return $arity;
}