Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Adds a class that defines the type of field to the <li> element in Gravity Forms
<?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
You can’t perform that action at this time.