Created
November 15, 2012 21:23
-
-
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
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
// 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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice, thanks!