Skip to content

Commit b0df1e4

Browse files
authored
Merge pull request #48 from joelpittet/theme-functions
Clean up form nested XHTML relic and remove grippie
2 parents fa5635f + 83065c2 commit b0df1e4

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

template.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,3 +950,30 @@ function megatron_megatron_links($variables) {
950950

951951
return $output;
952952
}
953+
954+
/**
955+
* Implements template_preprocess_textarea().
956+
*
957+
* Hide grippie.
958+
*/
959+
function megatron_preprocess_textarea(&$variables) {
960+
$variables['element']['#resizable'] = FALSE;
961+
}
962+
963+
/**
964+
* Implements theme_form().
965+
*
966+
* Removes the XHTML redundant inner div.
967+
*/
968+
function megatron_form($variables) {
969+
$element = $variables['element'];
970+
if (isset($element['#action'])) {
971+
$element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
972+
}
973+
element_set_attributes($element, array('method', 'id'));
974+
if (empty($element['#attributes']['accept-charset'])) {
975+
$element['#attributes']['accept-charset'] = "UTF-8";
976+
}
977+
978+
return '<form' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '</form>';
979+
}

0 commit comments

Comments
 (0)