quform_field_classes

This hook can be used to alter the classes of a field.

quform_field_classes_X_X

This hook is run for a single element.

Example

12
3
4
5
add_filter('quform_field_classes_1_3', function (array $classes, Quform_Element_Field $element, Quform_Form $form, array $context) {    $classes[] = 'my-custom-class';
 
    return $classes;
}, 10, 4);
add_filter('quform_field_classes_1_3', function (array $classes, Quform_Element_Field $element, Quform_Form $form, array $context) {
    $classes[] = 'my-custom-class';

    return $classes;
}, 10, 4);
  • On line 1, replace the 1_3 with the element unique ID
1
2
3
4
5
6
7
function my_field_classes(array $classes, Quform_Element_Field $element, Quform_Form $form, array $context)
{
    $classes[] = 'my-custom-class';
 
    return $classes;
}
add_filter('quform_field_classes_1_3', 'my_field_classes', 10, 4);
function my_field_classes(array $classes, Quform_Element_Field $element, Quform_Form $form, array $context)
{
    $classes[] = 'my-custom-class';

    return $classes;
}
add_filter('quform_field_classes_1_3', 'my_field_classes', 10, 4);
  • On line 7, replace the 1_3 with the element unique ID

Parameters

  • $classesarray – the current classes
  • $elementQuform_Element_Field – the element instance
  • $formQuform_Form – the form instance
  • $contextarray – the context data

quform_field_classes

This hook is run for all elements.

Example

1
2
3
4
5
add_filter('quform_field_classes', function (array $classes, Quform_Element_Field $element, Quform_Form $form, array $context) {
    // Custom code
 
    return $classes;
}, 10, 4);
add_filter('quform_field_classes', function (array $classes, Quform_Element_Field $element, Quform_Form $form, array $context) {
    // Custom code

    return $classes;
}, 10, 4);
1
2
3
4
5
6
7
function my_field_classes(array $classes, Quform_Element_Field $element, Quform_Form $form, array $context)
{
    // Custom code
 
    return $classes;
}
add_filter('quform_field_classes', 'my_field_classes', 10, 4);
function my_field_classes(array $classes, Quform_Element_Field $element, Quform_Form $form, array $context)
{
    // Custom code

    return $classes;
}
add_filter('quform_field_classes', 'my_field_classes', 10, 4);

Parameters

  • $classesarray – the current classes
  • $elementQuform_Element_Field – the element instance
  • $formQuform_Form – the form instance
  • $contextarray – the context data
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy