GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Data Fields | Private Member Functions | Static Private Member Functions
GravityView_Field_Address Class Reference

Add custom options for address fields. More...

Inheritance diagram for GravityView_Field_Address:
GravityView_Field

Public Member Functions

 __construct ()
 
 field_options ( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
 
 input_types ( $input_types)
 Add the input types available for each custom search field type. More...
 
 search_bar_input_type ( $input_type, $field_type, $field_id)
 Converts the custom input type (address) into the selected type. More...
 
 search_field_filter ( $search_fields, $widget, $widget_args)
 Dynamically add choices to the address field dropdowns, if any. More...
 
- Public Member Functions inherited from GravityView_Field
 __construct ()
 GravityView_Field constructor. More...
 
 _filter_gform_custom_merge_tags ( $custom_merge_tags=array(), $form_id=0, $fields=array(), $element_id='')
 Add custom merge tags to merge tag options. More...
 
 _filter_gform_replace_merge_tags ( $text, $form=array(), $entry=array(), $url_encode=false, $esc_html=false)
 Match the merge tag in replacement text for the field. More...
 
 _filter_sortable_fields ( $not_sortable)
 Use field settings to modify whether a field is sortable. More...
 
 add_entry_meta ( $entry_meta)
 Add the custom entry meta key to make it searchable and sortable. More...
 
 add_field_support ( $key, &$field_options)
 
 add_sortable_field ( $fields)
 Add the field to the Filter & Sort available fields. More...
 
 as_array ()
 Returns the field as an array to be used in field pickers. More...
 
 field_options ( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
 Tap in here to modify field options. More...
 
 replace_merge_tag ( $matches=array(), $text='', $form=array(), $entry=array(), $url_encode=false, $esc_html=false)
 Run GravityView filters when using GFCommon::replace_variables() More...
 
 set_default_search_label ( $label='', $gf_field=null, $field=array())
 Allow setting a default search label for search fields based on the field type. More...
 

Data Fields

 $_gf_field_class_name = 'GF_Field_Address'
 
 $group = 'advanced'
 
 $icon = 'dashicons-location-alt'
 
 $is_numeric = false
 
 $is_searchable = true
 
 $name = 'address'
 
 $search_operators = array( 'is', 'isnot', 'contains' )
 
- Data Fields inherited from GravityView_Field
 $_gf_field_class_name
 
 $contexts = array( 'single', 'multiple', 'edit', 'export' )
 
 $default_search_label
 
 $description
 
 $entry_meta_is_default_column = false
 
 $entry_meta_key = null
 
 $entry_meta_update_callback = null
 
 $group
 standard, advanced, post, pricing, meta, gravityview, or add-ons More...
 
 $icon = 'dashicons-admin-generic'
 
 $is_numeric
 boolean Is field content number-based? More...
 
 $is_searchable = true
 
 $is_sortable = true
 boolean Can the field be sorted in search? More...
 
 $label
 
 $name
 
 $search_operators
 

Private Member Functions

 add_hooks ()
 Add filters for this field type. More...
 
 get_choices_country ( $address_field)
 Get array of countries to use for the search choices. More...
 
 get_choices_state ( $address_field, $form)
 Get array of states to use for the search choices. More...
 

Static Private Member Functions

static get_input_type_from_input_id ( $input_id)
 Get a name for the input based on the input ID. More...
 

Additional Inherited Members

- Protected Member Functions inherited from GravityView_Field
 custom_merge_tags ( $form=array(), $fields=array())
 Add custom Merge Tags to Merge Tag options, if custom Merge Tags exist. More...
 
 is_choice_value_enabled ()
 Check whether the enableChoiceValue flag is set for a GF field. More...
 
- Protected Attributes inherited from GravityView_Field
 $_custom_merge_tag = false
 
 $_field_id = ''
 
 $_field_options = array()
 

Detailed Description

Add custom options for address fields.

Definition at line 11 of file class-gravityview-field-address.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Definition at line 37 of file class-gravityview-field-address.php.

References add_hooks().

Member Function Documentation

◆ add_hooks()

add_hooks ( )
private

Add filters for this field type.

Since
1.19.2
Returns
void

Definition at line 52 of file class-gravityview-field-address.php.

Referenced by __construct().

◆ field_options()

field_options (   $field_options,
  $template_id,
  $field_id,
  $context,
  $input_type,
  $form_id 
)

Definition at line 284 of file class-gravityview-field-address.php.

References $field_id.

◆ get_choices_country()

get_choices_country (   $address_field)
private

Get array of countries to use for the search choices.

Since
1.19.2
See also
GF_Field_Address::get_countries()
Parameters
GF_Field_Address$address_field
Returns
array Array of countries with value and text keys as the name of the country

Definition at line 118 of file class-gravityview-field-address.php.

◆ get_choices_state()

get_choices_state (   $address_field,
  $form 
)
private

Get array of states to use for the search choices.

Since
1.19.2

GF_Field_Address::get_us_states() GF_Field_Address::get_us_state_code() GF_Field_Address::get_canadian_provinces()

Parameters
GF_Field_Address$address_field
array$form
Returns
array Array of countries with value and text keys as the name of the country

Definition at line 148 of file class-gravityview-field-address.php.

References GV\$form.

◆ get_input_type_from_input_id()

static get_input_type_from_input_id (   $input_id)
staticprivate

Get a name for the input based on the input ID.

Since
1.19.2
Parameters
int$input_idID of the specific input for the address field
Returns
false|string If the input ID matches a known address field input, returns a name for that input ("city", or "country"). Otherwise, returns false.

Definition at line 256 of file class-gravityview-field-address.php.

References $input_id.

◆ input_types()

input_types (   $input_types)

Add the input types available for each custom search field type.

Since
1.19.2
Parameters
array$input_typesArray of input types as the keys (select, radio, multiselect, input_text) with a string or array of supported inputs as values
Returns
array $input_types array, but

Definition at line 203 of file class-gravityview-field-address.php.

References Utils\get().

◆ search_bar_input_type()

search_bar_input_type (   $input_type,
  $field_type,
  $field_id 
)

Converts the custom input type (address) into the selected type.

Since
1.19.2
Parameters
string$input_typeAssign an input type according to the form field type. Defaults: boolean, multi, select, date, text
string$field_typeGravity Forms field type (also the name parameter of GravityView_Field classes)
string | int | float$field_idID of the field being processed
Returns
string If the field ID matches an address field input, return those options {
See also
GravityView_Field_Address::input_types() }. Otherwise, original value is used.

Definition at line 230 of file class-gravityview-field-address.php.

References $field_id, $input_id, and gravityview_get_input_id_from_id().

◆ search_field_filter()

search_field_filter (   $search_fields,
  $widget,
  $widget_args 
)

Dynamically add choices to the address field dropdowns, if any.

Since
1.19.2
Parameters
array$search_fieldsArray of search filters with key, label, value, type keys
GravityView_Widget_Search$widgetCurrent widget object
array$widget_argsArgs passed to this method. {
Since
1.8}
Returns
array If the search field GF Field type is address, and there are choices to add, adds them and changes the input type. Otherwise, sets the input to text.

GF_Field_Address $address_field

GravityView_Field_Address::get_choices_country() GravityView_Field_Address::get_choices_state()

Definition at line 69 of file class-gravityview-field-address.php.

References $field_id, GV\$form, $input_id, $search_field, Utils\get(), GravityView_View\getInstance(), and gravityview_get_input_id_from_id().

Field Documentation

◆ $_gf_field_class_name

$_gf_field_class_name = 'GF_Field_Address'

Definition at line 35 of file class-gravityview-field-address.php.

◆ $group

$group = 'advanced'

Definition at line 17 of file class-gravityview-field-address.php.

◆ $icon

$icon = 'dashicons-location-alt'

Definition at line 32 of file class-gravityview-field-address.php.

◆ $is_numeric

$is_numeric = false

Definition at line 20 of file class-gravityview-field-address.php.

◆ $is_searchable

$is_searchable = true

Definition at line 23 of file class-gravityview-field-address.php.

◆ $name

$name = 'address'

Definition at line 14 of file class-gravityview-field-address.php.

◆ $search_operators

$search_operators = array( 'is', 'isnot', 'contains' )

Definition at line 26 of file class-gravityview-field-address.php.


The documentation for this class was generated from the following file: