bookmark_bordergform_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 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 ) { //build field name, must match List field syntax to be processed correctly $input_field_name = 'input_' . $field->id . '[]'; $tabindex = GFCommon::get_tabindex(); $new_input = '<textarea name="' . $input_field_name . '" ' . $tabindex . ' class="textarea medium" cols="50" rows="10">' . $value . '</textarea>'; return $new_input; }
Placement
This code should be placed in the functions.php file of your active theme
Source Code
This filter is located in GF_Field_List::get_list_input() in includes/fields/class-gf-field-list.php
Last modified: October 4, 2017