gform_field_container

gform_field_container

DescriptionUsageParametersExamplePlacementSource CodeSince

Description
This filter can be used to modify the markup, the li, used for the field container.
Usage
The base filter which would run for all forms and all fields would be used like so:
1add_filter( 'gform_field_container', 'your_function_name', 10, 6 );
To target a specific form append the form id to the hook name. (format: gform_field_container_FORMID)
1add_filter( 'gform_field_container_10', 'your_function_name', 10, 6 );
To target a specific field append both the form id and the field id to the hook name. (format: gform_field_container_FORMID_FIELDID)
1add_filter( 'gform_field_container_10_3', 'your_function_name', 10, 6 );

Parameters

$field_container string
The field container markup. The placeholder {FIELD_CONTENT} indicates where the markup for the field content should be located.

$field Field Object
The field currently being processed.

$form Form Object
The Form currently being processed.

$css_class string
The CSS classes to be assigned to the li element.

$style string
An empty string as of 1.9.4.4. Was previously used to hold the conditional logic display style.

$field_content string
The markup for the field content (label, description, and inputs etc) which will replace the {FIELD_CONTENT} placeholder.

Example
1234add_filter( 'gform_field_container', 'my_field_container', 10, 6 );function my_field_container( $field_container, $field, $form, $css_class, $style, $field_content ) {    return '

  • {FIELD_CONTENT}
  • ';}
    Placement
    This code should be placed in the functions.php file of your active theme.
    Source Code
    1gf_apply_filters( 'gform_field_container', array( $form['id'], $field->id ), $field_container, $field, $form, $css_class, $style, $field_content );
    This filter is located in GFFormDisplay::get_field() in form_display.php
    Since
    This filter was added in Gravity Forms 1.8.9.

    發表回覆

    您的郵箱地址不會被公開。 必填項已用 * 標註