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_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