protected function OptionsLimitWebformHandler::getOptionsReached in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php \Drupal\webform_options_limit\Plugin\WebformHandler\OptionsLimitWebformHandler::getOptionsReached()
Get value array of options reached.
Parameters
array $limits: An associative array of options limits.
Return value
array A value array of disabled options.
1 call to OptionsLimitWebformHandler::getOptionsReached()
- OptionsLimitWebformHandler::alterElement in modules/
webform_options_limit/ src/ Plugin/ WebformHandler/ OptionsLimitWebformHandler.php - Alter webform element.
File
- modules/
webform_options_limit/ src/ Plugin/ WebformHandler/ OptionsLimitWebformHandler.php, line 1258
Class
- OptionsLimitWebformHandler
- Webform options and boolean (boolean) limit handler.
Namespace
Drupal\webform_options_limit\Plugin\WebformHandlerCode
protected function getOptionsReached(array $limits) {
$element_key = $this->configuration['element_key'];
$webform_submission = $this
->getWebformSubmission();
$element_values = (array) $webform_submission
->getElementOriginalData($element_key) ?: [];
$reached = [];
foreach ($limits as $option_value => $limit) {
if ($element_values && in_array($option_value, $element_values)) {
continue;
}
if ($limit['status'] === WebformOptionsLimitHandlerInterface::LIMIT_STATUS_NONE) {
$reached[$option_value] = $option_value;
}
}
return $reached;
}