bookmark_bordergform_field_choices

Description

This filter is executed when creating the checkbox items. It can be used to manipulate the item’s string before it gets added to the checkbox list.

Usage

add_filter( 'gform_field_choices', 'form_submit_button', 10, 2 );

Parameters

  • $choices string

    The string containing the choices to be filtered i.e.

    <option>Item 1</option><option>Item 2</option>

$field Field Object

The current field.

Examples

This example demonstrates how to allow HTML characters on checkbox and radio items.

add_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