gform_field_type_title

Description

When adding a new field type, use this filter to assign a title to the new type.

Usage

add_filter( 'gform_field_type_title', 'assign_title', 10, 2 );

Parameters

  • $title string
    Title to be filtered. Defaults to the field type.
  • $field_type string
    Field type.

Examples

This example assigns a title to a new custom field type.

add_filter( 'gform_field_type_title', 'assign_title', 10, 2 );

function assign_title( $title, $field_type ) {
    if ( $field_type == 'map' ) {
        return 'Map';
    } 
    else {
        return $title;
    }
}

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 GFCommon::get_field_type_title() in common.php