\n";
$required = !empty($element['#required']) ? '*' : '';
if (!empty($element['#title'])) {
$title = $element['#title'];
if (!empty($element['#id'])) {
$output .= ' \n";
}
else {
$output .= ' \n";
}
}
//TODO test to see if this is clean text - then we might need a
//if we need to catch the content with
$output .= "$value\n";
if (!empty($element['#description'])) {
$output .= '
'. $element['#description'] ."
\n";
}
$output .= "\n";
return $output;
}
/* and size is not set to 20 so we might have a chance to style the it */
function mothership_file($element) {
_form_set_class($element, array('file'));
return theme('form_element', $element, '');
/* size="20" */
}
function mothership_checkbox($element) {
_form_set_class($element, array('checkbox'));
$checkbox = '';
if (!is_null($element['#title'])) {
$checkbox = '';
}
unset($element['#title']);
return theme('form_element', $element, $checkbox);
}
/*adds a span tag inside the legend so we can control the legend width*/
function mothership_fieldset($element) {
if (!empty($element['#collapsible'])) {
drupal_add_js('misc/collapse.js');
if (!isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = '';
}
//adds the name of the fieldset to the class
$element['#attributes']['class'] .= ' '.mothership_id_safe($element['#title']);
$element['#attributes']['class'] .= ' collapsible';
if (!empty($element['#collapsed'])) {
$element['#attributes']['class'] .= ' collapsed';
}
}
return '\n";
}
function mothership_button($element) {
// Override theme_button ads spans around it so we can tweak the shit out it
//http://teddy.fr/blog/beautify-your-drupal-forms
// Make sure not to overwrite classes.
if (isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = 'form-' . $element['#button_type'] .' '. $element['#attributes']['class'];
}
else {
$element['#attributes']['class'] = 'form-' . $element['#button_type'];
}
// We here wrap the output with a div + span tag
return '
\n";
}
function mothership_image_button($element) {
// Make sure not to overwrite classes.
if (isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class'];
}
else {
$element['#attributes']['class'] = 'form-'. $element['#button_type'];
}
return '\n";
}