protected function OptionsLimitWebformHandler::removeOptionsElementRecursive in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php \Drupal\webform_options_limit\Plugin\WebformHandler\OptionsLimitWebformHandler::removeOptionsElementRecursive()
Remove options element's reached options.
Parameters
array $options: An array options (and optgroups).
array $reached: An options element's reached options.
1 call to OptionsLimitWebformHandler::removeOptionsElementRecursive()
- OptionsLimitWebformHandler::removeOptionsElement in modules/
webform_options_limit/ src/ Plugin/ WebformHandler/ OptionsLimitWebformHandler.php - Remove options element's reached options.
File
- modules/
webform_options_limit/ src/ Plugin/ WebformHandler/ OptionsLimitWebformHandler.php, line 758
Class
- OptionsLimitWebformHandler
- Webform options and boolean (boolean) limit handler.
Namespace
Drupal\webform_options_limit\Plugin\WebformHandlerCode
protected function removeOptionsElementRecursive(array &$options, array $reached) {
foreach ($options as $option_value => &$option_text) {
if (is_array($option_text)) {
$this
->removeOptionsElementRecursive($option_text, $reached);
if (empty($option_text)) {
unset($options[$option_value]);
}
}
elseif (isset($reached[$option_value])) {
unset($options[$option_value]);
}
}
}