gform_field_choices

gform_field_choices

DescriptionUsageParametersExamplesPlacementSource Code

Description
This filter is executed when creating the checkbox or radio button items. It can be used to manipulate the item』s string before it gets added to the checkbox or radio button list.
Usage
1add_filter( 'gform_field_choices', 'form_submit_button', 10, 2 );
Parameters

$choices string
The string containing the choices to be filtered i.e.
1$field Field Object
The current field.

Examples
This example demonstrates how to allow HTML characters on checkbox and radio items.
12345add_filter( 'gform_field_choices', 'decode_specialchars', 10, 2 );function decode_specialchars( $choices, $field ) {    $choices = htmlspecialchars_decode( $choices );    return $choices;}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in the following methods:

GF_Field_Checkbox::get_checkbox_choices() in includes/fields/class-gf-field-checkbox.php
GF_Field_Radio::get_radio_choices() in includes/fields/class-gf-field-radio.php

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注