Skip to main content

GF_Field_Name

Class GF_Field_Name

Handles the behavior of the Name field.

Since: Unknown

Source: includes/fields/class-gf-field-name.php:15

Details​

  • Kind: class
  • Namespace: (global)
  • Extends: GF_Field

Properties​

PropertyTypeDescription
$typestringThe type of field.
$repeatableboolWhether the field can be used in a repeater.
$_supports_state_validationboolIndicates if this field supports state validation.
$noURLsboolWhether this field allows links/URLs in the value.

Methods​

MethodDescription
get_field_container_tag()Returns the HTML tag for the field container.
get_form_editor_field_title()Sets the field title of the Name field.
get_form_editor_field_description()Returns the field's form editor description.
get_form_editor_field_icon()Returns the field's form editor icon.
is_conditional_logic_supported()Defines if conditional logic is supported by the Name field.
get_required_inputs_ids()Defines the IDs of required inputs.
validate()Validates Name field inputs.
get_form_editor_field_settings()Defines the field settings available for the Name field in the form editor.
get_field_input()Gets the HTML markup for the field input.
get_css_class()Sets the CSS class to be used by the field input.
get_name_prefix_field()Defines the field markup to be used for the name prefix.
get_value_entry_detail()Gets the field value to be displayed on the entry detail page.
sanitize_settings()Sanitizes the field settings choices.
get_first_input_id()Removes the "for" attribute in the field label. Inputs are only allowed one label (a11y) and the inputs already have labels.
get_filter_sub_filters()Returns the sub-filters for the current field.
get_filter_operators()Returns the filter operators for the current field.
is_state_validation_supported()Determines if this field will be processed by the state validation.
get_values_for_state_hash()Prepares the value that will be hashed on form display as part of the state.
skip_state_validation_if_blank()Indicates if state validation should be skipped if the submitted value is blank.

Method Reference​

get_field_container_tag()​

public function get_field_container_tag( $form )

Returns the HTML tag for the field container.

Parameters​

NameTypeDefaultDescription
$formarrayThe current Form object.

Returns​

  • string

Since: 2.5

Source: includes/fields/class-gf-field-name.php:63

get_form_editor_field_title()​

public function get_form_editor_field_title()

Sets the field title of the Name field.

Returns​

  • string

Since: Unknown

Source: includes/fields/class-gf-field-name.php:84

get_form_editor_field_description()​

public function get_form_editor_field_description()

Returns the field's form editor description.

Returns​

  • string

Since: 2.5

Source: includes/fields/class-gf-field-name.php:95

get_form_editor_field_icon()​

public function get_form_editor_field_icon()

Returns the field's form editor icon.

This could be an icon url or a gform-icon class.

Returns​

  • string

Since: 2.5

Source: includes/fields/class-gf-field-name.php:108

is_conditional_logic_supported()​

public function is_conditional_logic_supported()

Defines if conditional logic is supported by the Name field.

Returns​

  • bool — true

Since: Unknown

Source: includes/fields/class-gf-field-name.php:123

get_required_inputs_ids()​

public function get_required_inputs_ids()

Defines the IDs of required inputs.

Returns​

  • string[]

Since: 2.5

Source: includes/fields/class-gf-field-name.php:134

validate()​

function validate( $value, $form )

Validates Name field inputs.

Parameters​

NameTypeDefaultDescription
$valuearray | stringThe value of the field to validate. Not used here.
$formarrayThe Form Object. Not used here.

Returns​

  • void

Since:

  • 1.9
  • 2.6.5 (Updated to use set_required_error().)

Source: includes/fields/class-gf-field-name.php:158

get_form_editor_field_settings()​

function get_form_editor_field_settings()

Defines the field settings available for the Name field in the form editor.

Returns​

  • array — The field settings available.

Since: Unknown

Source: includes/fields/class-gf-field-name.php:174

get_field_input()​

public function get_field_input( $form, $value='', $entry=null )

Gets the HTML markup for the field input.

Parameters​

NameTypeDefaultDescription
$formarrayThe Form Object.
$valuestring''The value of the field. Defaults to empty string.
$entryarray | nullnullThe Entry Object. Defaults to null.

Returns​

  • string — The HTML markup for the field input.

Since: Unknown

Source: includes/fields/class-gf-field-name.php:221

get_css_class()​

public function get_css_class()

Sets the CSS class to be used by the field input.

Returns​

  • string — The CSS class to use for the field.

Since: Unknown

Source: includes/fields/class-gf-field-name.php:483

get_name_prefix_field()​

public function get_name_prefix_field( $input, $id, $field_id, $value, $disabled_text, $tabindex )

Defines the field markup to be used for the name prefix.

Parameters​

NameTypeDefaultDescription
$inputarrayThe input item choices.
$idintThe ID of the name field.
$field_idintThe field ID of the name field.
$valuestringThe value to be used in the prefix field item.
$disabled_textstringThe text to be used if the prefix field item is disabled.
$tabindexintThe tab index of the prefix field item.

Returns​

  • string — The field HTML markup.

Since: Unknown

Source: includes/fields/class-gf-field-name.php:553

get_value_entry_detail()​

public function get_value_entry_detail( $value, $entry=[], $use_text=false, $format='html', $media='screen' )

Gets the field value to be displayed on the entry detail page.

Parameters​

NameTypeDefaultDescription
$valuearray | stringThe value of the field input.
$entryarray[]Not used.
$use_textboolfalseNot used.
$formatstring'html'The format to output the value. Defaults to 'html'.
$mediastring'screen'Not used.

Returns​

  • array | string — The value to be displayed on the entry detail page.

Since:

  • Unknown
  • 2.9.29 (Changed the second parameter $currency (string) to $entry (array).)

Source: includes/fields/class-gf-field-name.php:597

sanitize_settings()​

public function sanitize_settings()

Sanitizes the field settings choices.

Returns​

  • void

Since: Unknown

Source: includes/fields/class-gf-field-name.php:636

get_first_input_id()​

public function get_first_input_id( $form )

Removes the "for" attribute in the field label. Inputs are only allowed one label (a11y) and the inputs already have labels.

Parameters​

NameTypeDefaultDescription
$formarrayThe Form Object currently being processed.

Returns​

  • string

Since: 2.4

Source: includes/fields/class-gf-field-name.php:702

get_filter_sub_filters()​

public function get_filter_sub_filters()

Returns the sub-filters for the current field.

Returns​

  • array

Since: 2.4

Source: includes/fields/class-gf-field-name.php:715

get_filter_operators()​

public function get_filter_operators()

Returns the filter operators for the current field.

Returns​

  • array

Since: 2.4

Source: includes/fields/class-gf-field-name.php:747

is_state_validation_supported()​

public function is_state_validation_supported()

Determines if this field will be processed by the state validation.

Returns​

  • bool

Since: 3.0

Source: includes/fields/class-gf-field-name.php:761

get_values_for_state_hash()​

public function get_values_for_state_hash( $value )

Prepares the value that will be hashed on form display as part of the state.

Parameters​

NameTypeDefaultDescription
$valuestring | arrayThe default value.

Returns​

  • null | array

Since: 3.0

Source: includes/fields/class-gf-field-name.php:774

skip_state_validation_if_blank()​

public function skip_state_validation_if_blank( $key )

Indicates if state validation should be skipped if the submitted value is blank.

Parameters​

NameTypeDefaultDescription
$keystring | intThe field or input ID.

Returns​

  • bool

Since: 3.0

Source: includes/fields/class-gf-field-name.php:796