Skip to content

Instantly share code, notes, and snippets.

@phile
Created November 15, 2012 21:23
Show Gist options
  • Save phile/4081365 to your computer and use it in GitHub Desktop.
Save phile/4081365 to your computer and use it in GitHub Desktop.
Drupal 7: How to remove a HTML class from a form item using hook form_alter
// remove html class from form item
function theme_name_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'form_id':
$classes = &$form['actions']['item_name']['#attributes']['class'];
$classes = array_filter($classes , function($e){
return $e != 'class_to_remove';
});
break;
}
}
@krisrobinson
Copy link

Nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment