Skip to content

Instantly share code, notes, and snippets.

@jdwfly
Last active October 12, 2015 22:28
Show Gist options
  • Save jdwfly/4096831 to your computer and use it in GitHub Desktop.
Save jdwfly/4096831 to your computer and use it in GitHub Desktop.
<?php
function customtheme_form($variables) {
$element = $variables['element'];
if (strpos($element['#id'], 'webform') == FALSE) {
$element['#attributes'] = array('data-persist' => 'garlic');
}
if (isset($element['#action'])) {
$element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
}
element_set_attributes($element, array('method', 'id'));
if (empty($element['#attributes']['accept-charset'])) {
$element['#attributes']['accept-charset'] = "UTF-8";
}
// Anonymous DIV to satisfy XHTML compliance.
return '<form' . drupal_attributes($element['#attributes']) . '><div>' . $element['#children'] . '</div></form>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment