protected function WebformDevelEntityFormApiBaseForm::cleanupElements in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_devel/src/Form/WebformDevelEntityFormApiBaseForm.php \Drupal\webform_devel\Form\WebformDevelEntityFormApiBaseForm::cleanupElements()
Cleanup webform elements.
Parameters
array $elements: An render array representing elements.
2 calls to WebformDevelEntityFormApiBaseForm::cleanupElements()
- WebformDevelEntityFormApiExportForm::buildForm in modules/
webform_devel/ src/ Form/ WebformDevelEntityFormApiExportForm.php - Form constructor.
- WebformDevelEntityFormApiTestForm::buildForm in modules/
webform_devel/ src/ Form/ WebformDevelEntityFormApiTestForm.php - Form constructor.
File
- modules/
webform_devel/ src/ Form/ WebformDevelEntityFormApiBaseForm.php, line 90
Class
- WebformDevelEntityFormApiBaseForm
- Export a webform's element to Form API (FAPI).
Namespace
Drupal\webform_devel\FormCode
protected function cleanupElements(array &$elements) {
foreach ($elements as $element_key => $element) {
if (isset($element['#type'])) {
switch ($element['#type']) {
// Remove unsupported element types.
case 'webform_actions':
unset($elements[$element_key]);
break;
// Convert wizard pages to fieldset.
case 'webform_wizard':
$element['#type'] = 'fieldset';
break;
}
}
// Recursively cleanup child elements.
if (Element::child($element_key) && is_array($element)) {
$this
->cleanupElements($element);
}
}
}