Created
October 23, 2014 14:42
-
-
Save josephmosby/28abde8cd14837142a88 to your computer and use it in GitHub Desktop.
Webform.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pls_webform_element($variables) { | |
$element = $variables['element']; | |
$value = $variables['element']['#children']; | |
$wrapper_classes = array( | |
'form-item', | |
); | |
$output = '<div class="' . implode(' ', $wrapper_classes) . '" id="' . $element['#id'] . '-wrapper">' . "\n"; | |
$required = !empty($element['#required']) ? '<span class="form-required" title="' . t('This field is required.') . '">*</span>' : ''; | |
if (!empty($element['#title'])) { | |
$title = $element['#title']; | |
$output .= ' <label for="' . $element['#id'] . '">' . t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n"; | |
} | |
if (!empty($element['#description'])) { | |
$output .= ' <div class="description">' . $element['#description'] . "</div>\n"; | |
} | |
$output .= '<div id="' . $element['#id'] . '">' . $value . '</div>' . "\n"; | |
$output .= "</div>\n"; | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment