Created
October 4, 2018 06:17
-
-
Save cameronjonesweb/09d0c756e08bb62ce9bba4ba5e84e38a to your computer and use it in GitHub Desktop.
Adds a class that defines the type of field to the <li> element in Gravity Forms
This file contains hidden or 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
| <?php | |
| add_filter( 'gform_field_css_class', 'cameronjonesweb_add_field_type_to_class', 10, 3 ); | |
| /** | |
| * Adds a class that defines the type of field to the li element in Gravity Forms | |
| * | |
| * @param string $css_class The existing CSS classes. | |
| * @param GF_Field $field The field object. | |
| * @param array $form The form object. | |
| * @return string | |
| */ | |
| function cameronjonesweb_add_field_type_to_class( $css_class, $field, $form ) { | |
| $css_class .= ' gfield--' . $field->type; | |
| return $css_class; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment