function _webform_group_form_webform_handler_form_alter_email_element_recursive in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_group/webform_group.module \_webform_group_form_webform_handler_form_alter_email_element_recursive()
Add group role token options to email handler elements.
Parameters
array $form: A form.
array $options: Group role token options.
1 call to _webform_group_form_webform_handler_form_alter_email_element_recursive()
- webform_group_form_webform_handler_form_alter in modules/
webform_group/ webform_group.module - Implements hook_form_FORM_ID_alter() for webform handler form.
File
- modules/
webform_group/ webform_group.module, line 129 - Provides a Webform integration with the Group module.
Code
function _webform_group_form_webform_handler_form_alter_email_element_recursive(array &$form, array $options) {
foreach ($form as $element_key => &$element) {
if (!Element::child($element_key) || !is_array($element)) {
continue;
}
if (isset($element['#type']) && $element['#type'] === 'webform_select_other' && isset($element['#other__type']) && $element['#other__type'] === 'webform_email_multiple') {
$group_optgroup = (string) t('Group roles');
$other_optgroup = (string) t('Other');
$other_options = $element['#options'][$other_optgroup];
unset($element['#options'][$other_optgroup]);
$element['#options'][$group_optgroup] = $options;
$element['#options'][$other_optgroup] = $other_options;
}
_webform_group_form_webform_handler_form_alter_email_element_recursive($element, $options);
}
}