GF_Field_Address
Source: includes/fields/class-gf-field-address.php:7
Details
- Kind:
class - Namespace:
(global) - Extends: GF_Field
Properties
| Property | Type | Description |
|---|---|---|
$_supports_state_validation | bool | Indicates if this field supports state validation. |
Methods
| Method | Description |
|---|---|
get_form_editor_field_description() | Returns the field's form editor description. |
get_form_editor_field_icon() | Returns the field's form editor icon. |
get_required_inputs_ids() | Defines the IDs of required inputs. |
get_field_container_tag() | Returns the HTML tag for the field container. |
validate() | Validates the address field inputs. |
get_default_address_type() | Retrieve the default address type for this field. |
get_selected_address_type() | Returns the properties of the selected address type. |
get_state_field() | Generates state field markup. |
get_countries() | Returns a list of countries. |
get_default_countries() | Returns the default array of countries using the ISO 3166-1 alpha-2 code as the key to the country name. |
get_country_code() | Returns the ISO 3166-1 alpha-2 code for the supplied country name. |
get_country_codes() | Returns the default countries array updated to use the uppercase country name as the key to the ISO 3166-1 alpha-2 code. |
get_us_states() | Returns the array of US states and territories. |
get_us_state_code() | Returns the two-letter US state code from the state name provided. |
get_select_option() | Returns the option tag for the current choice. |
get_value_entry_detail() | Format the entry value for display on the entry detail page and for the {all_fields} merge tag. |
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. |
skip_state_validation_if_blank() | Indicates if state validation should be skipped if the submitted value is blank. |
get_values_for_state_hash() | Prepares the value that will be hashed on form display as part of the state. |
Method Reference
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-address.php:56
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-address.php:69
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-address.php:80
get_field_container_tag()
public function get_field_container_tag( $form )
Returns the HTML tag for the field container.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The current Form object. |
Returns
string
Since: 2.5
Source: includes/fields/class-gf-field-address.php:94
validate()
public function validate( $value, $form )
Validates the address field inputs.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The field value from get_value_submission(). | |
$form | array | The Form Object currently being processed. |
Returns
void
Since:
Source: includes/fields/class-gf-field-address.php:115
get_default_address_type()
public function get_default_address_type( $form_id )
Retrieve the default address type for this field.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form_id | int | The current form ID. |
Returns
string
Source: includes/fields/class-gf-field-address.php:529
get_selected_address_type()
public function get_selected_address_type()
Returns the properties of the selected address type.
Returns
array
Since: 3.0
Source: includes/fields/class-gf-field-address.php:549
get_state_field()
public function get_state_field( $id, $field_id, $state_value, $disabled_text, $form_id, $aria_attributes='', $address_state_field_input='' )
Generates state field markup.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$id | integer | Input id. | |
$field_id | integer | Field id. | |
$state_value | string | State value. | |
$disabled_text | string | Disabled attribute. | |
$form_id | integer | Current form id being processed. | |
$aria_attributes | string | '' | Aria attributes values. |
$address_state_field_input | '' |
Returns
string
Since:
unknown2.5(added new params $$aria_attributes.)
Source: includes/fields/class-gf-field-address.php:574
get_countries()
public function get_countries()
Returns a list of countries.
Returns
array
Since:
Unknown2.4(Updated to use ISO 3166-1 list of countries.)2.4.20(Updated to use GF_Field_Address::get_default_countries() and to sort the countries.)
Source: includes/fields/class-gf-field-address.php:634
get_default_countries()
public function get_default_countries()
Returns the default array of countries using the ISO 3166-1 alpha-2 code as the key to the country name.
Returns
array
Since: 2.4.20
Source: includes/fields/class-gf-field-address.php:657
get_country_code()
public function get_country_code( $country_name )
Returns the ISO 3166-1 alpha-2 code for the supplied country name.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$country_name | string | The country name. |
Returns
string|null
Since: Unknown
Source: includes/fields/class-gf-field-address.php:920
get_country_codes()
public function get_country_codes()
Returns the default countries array updated to use the uppercase country name as the key to the ISO 3166-1 alpha-2 code.
Returns
array
Since:
Unknown2.4(Updated to use ISO 3166-1 list of countries.)2.4.20(Updated to use GF_Field_Address::get_default_countries().)
Source: includes/fields/class-gf-field-address.php:935
get_us_states()
public function get_us_states()
Returns the array of US states and territories.
Returns
array— The array of US states.
Since: Unknown
Source: includes/fields/class-gf-field-address.php:948
get_us_state_code()
public function get_us_state_code( $state_name )
Returns the two-letter US state code from the state name provided.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$state_name | string | The state name. |
Returns
string— The two-letter US state code.
Since: Unknown
Source: includes/fields/class-gf-field-address.php:1030
get_select_option()
public function get_select_option( $value, $label, $selected_value )
Returns the option tag for the current choice.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | The choice value. | |
$label | string | The choice label. | |
$selected_value | string | The value for the selected choice. |
Returns
string
Source: includes/fields/class-gf-field-address.php:1146
get_value_entry_detail()
public function get_value_entry_detail( $value, $entry=[], $use_text=false, $format='html', $media='screen' )
Format the entry value for display on the entry detail page and for the {all_fields} merge tag.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The field value. | |
$entry | array | [] | The entry. |
$use_text | bool | false | false | When processing choice based fields should the choice text be returned instead of the value. |
$format | string | 'html' | The format requested for the location the merge is being used. Possible values: html, text or url. |
$media | string | 'screen' | The location where the value will be displayed. Possible values: screen or email. |
Returns
string
Since:
Source: includes/fields/class-gf-field-address.php:1210
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
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form Object currently being processed. |
Returns
string
Since: 2.4
Source: includes/fields/class-gf-field-address.php:1357
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-address.php:1370
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-address.php:1397
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
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | int | The field or input ID. |
Returns
bool
Since: 3.0
Source: includes/fields/class-gf-field-address.php:1413
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
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The default value. |
Returns
null|array
Since: 3.0
Source: includes/fields/class-gf-field-address.php:1434