gform_column_input_content

Description

This filter can be used to modify the HTML content of the list field column input tag.

Usage

add_filter( 'gform_column_input_content', 'your_function_name', 10, 6 );

You can also target a specific column by adding the form id, field id and column number after the hook name. (format: gform_column_input_content_FORMID_FIELDID_COLUMN)

// This filter declaration targets the third column of the field whose id is 9 in form whose id is 21
add_filter( 'gform_column_input_content_21_9_3', 'your_function_name', 10, 6 );

Parameters

  • $input string
    The current HTML content of the List field column
  • $input_info array
    The input info array to be filtered, in the following format:
array(
    'type' => 'select',
    'choices' => 'First Choice,Second Choice'
);
 
// OR, if values need to be specified for each choice, the following format can also be used:
array(
    'type' => 'select',
    'choices' => array(
        array( 'text' => 'First Choice', 'value' => 'First' ),
        array( 'text' => 'Second Choice', 'value' => 'Second' )
    )
);
  • $field Field Object
    Current field
  • $text string
    Current column name
  • $value string
    Currently entered/selected value for the column’s input
  • $form_id integer
    ID of the current form

Examples

This example changes the third column of the list field to a textarea. To display the value on the entry in the admin, make sure you include using $value in the appropriate location for your tag creation.

add_filter( 'gform_column_input_content_21_9_3', 'change_column3_content', 10, 6 );
function change_column3_content( $input, $input_info, $field, $text, $value, $form_id ) {
	return sprintf( '<textarea name="input_%1$d[]" class="textarea medium" cols="50" rows="10" >%2$s</textarea>', $field->id, esc_textarea( $value ) );
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

This filter is located in GF_Field_List::get_list_input() in includes/fields/class-gf-field-list.php