diff --git a/accessible_fix/module_fixes/webform.inc b/accessible_fix/module_fixes/webform.inc index b6a5eec..798ec9c 100644 --- a/accessible_fix/module_fixes/webform.inc +++ b/accessible_fix/module_fixes/webform.inc @@ -4,57 +4,28 @@ /** * Replacement for theme_webform_element(). */ -function accessible_fix_webform_element($variables) -{ - // Ensure defaults. - $variables['element'] += array( - '#title_display' => 'before', - ); - +function accessible_fix_webform_element($variables) { $element = $variables['element']; - // All elements using this for display only are given the "display" type. - if (isset($element['#format']) && $element['#format'] == 'html') { - $type = 'display'; - } else { - $type = (isset($element['#type']) && !in_array($element['#type'], array('markup', 'textfield'))) ? $element['#type'] : $element['#webform_component']['type']; - } - $parents = str_replace('_', '-', implode('--', array_slice($element['#parents'], 1))); - - $wrapper_classes = array( - 'form-item', - 'webform-component', - 'webform-component-' . $type, - ); - if (isset($element['#title_display']) && $element['#title_display'] == 'inline') { - $wrapper_classes[] = 'webform-container-inline'; - } - $output = '
' . "\n"; + $output = '
' . "\n"; // Composite elements consist of more than one HTML form control. These must be grouped by a fieldset. // Developers can mark any fieldtype as composite with #composite. // radios, checkboxes, and date are marked as composite. In D8, they are so marked in their respective form_process_*(). - if (isset($element['#type']) && in_array($element['#type'], array('radios', 'checkboxes', 'date', 'webform_grid', 'webform_time'), true)) { - $element['#composite'] = true; + if (isset($element['#type']) && in_array($element['#type'], array('radios', 'checkboxes', 'date', 'webform_grid', 'webform_time'), TRUE)) { + $element['#composite'] = TRUE; } - $composite = false; - if (isset($element['#composite']) && $element['#composite'] === true) { - $composite = true; + $composite = FALSE; + if (isset($element['#composite']) && $element['#composite'] === TRUE) { + $composite = TRUE; } if ($composite) { $output .= ' 'fieldset-invisible')) . '>'; } - // If #title is not set, we don't display any label or required marker. - if (!isset($element['#title'])) { - $element['#title_display'] = 'none'; - } - if (!isset($element['#children'])) { - $element['#children'] = ''; - } - $prefix = isset($element['#field_prefix']) ? '' . _webform_filter_xss($element['#field_prefix']) . ' ' : ''; - $suffix = isset($element['#field_suffix']) ? ' ' . _webform_filter_xss($element['#field_suffix']) . '' : ''; + $prefix = isset($element['#field_prefix']) ? '' . webform_filter_xss($element['#field_prefix']) . ' ' : ''; + $suffix = isset($element['#field_suffix']) ? ' ' . webform_filter_xss($element['#field_suffix']) . '' : ''; $children = ' ' . $prefix . $element['#children'] . $suffix; // Generate the title, either a legend or a label, only if the title will be used @@ -66,7 +37,7 @@ function accessible_fix_webform_element($variables) } $title = '' . $element['#title']; if (!empty($element['#required'])) { - $title .= theme('form_required_marker', array('element' => $element)); + $title .= ' ' . theme('form_required_marker', array('element' => $element)); } $title .= ''; } else { @@ -78,23 +49,22 @@ function accessible_fix_webform_element($variables) case 'inline': case 'before': case 'invisible': - $output .= $title . $children; + $output .= $title . $children . "\n"; break; case 'after': - $output .= $children . $title; + $output .= $children . $title . "\n"; break; case 'none': case 'attribute': // Output no label and no required marker, only the children. - $output .= $children; + $output .= $children . "\n"; break; } - $output .= "\n"; if (!empty($element['#description'])) { - $output .= '
' . $element['#description'] . "
\n"; + $output .= '
' . $element['#description'] . "
\n"; } if ($composite) {