public static function WebformToggles::processCheckboxes in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_toggles/src/Element/WebformToggles.php \Drupal\webform_toggles\Element\WebformToggles::processCheckboxes()
Processes a checkboxes form element.
Overrides Checkboxes::processCheckboxes
File
- modules/
webform_toggles/ src/ Element/ WebformToggles.php, line 26
Class
- WebformToggles
- Provides a webform element for toggles.
Namespace
Drupal\webform_toggles\ElementCode
public static function processCheckboxes(&$element, FormStateInterface $form_state, &$complete_form) {
$element = parent::processCheckboxes($element, $form_state, $complete_form);
// Convert checkboxes to toggle elements.
foreach (Element::children($element) as $key) {
$element[$key]['#type'] = 'webform_toggle';
$element[$key] += array_intersect_key($element, WebformToggle::getDefaultProperties());
}
return $element;
}