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

Modify field settings by extending this class. More...

Inheritance diagram for GravityView_Field:
GravityView_Field_Address GravityView_Field_Calculation GravityView_Field_Captcha GravityView_Field_Chained_Select GravityView_Field_Checkbox GravityView_Field_Consent GravityView_Field_Created_By GravityView_Field_CreditCard GravityView_Field_Currency GravityView_Field_Custom GravityView_Field_Date GravityView_Field_Date_Created GravityView_Field_Email GravityView_Field_Entry_Approval GravityView_Field_Entry_Link GravityView_Field_FileUpload GravityView_Field_Gravatar GravityView_Field_Hidden GravityView_Field_HTML GravityView_Field_ID GravityView_Field_IP GravityView_Field_Is_Approved GravityView_Field_Is_Fulfilled GravityView_Field_Is_Starred GravityView_Field_List GravityView_Field_MultiSelect GravityView_Field_Name GravityView_Field_Notes GravityView_Field_Number GravityView_Field_Option GravityView_Field_Other_Entries GravityView_Field_Page GravityView_Field_Password GravityView_Field_Payment_Amount GravityView_Field_Payment_Method GravityView_Field_Payment_Status GravityView_Field_Phone GravityView_Field_Pipe_Recorder GravityView_Field_Post_Category GravityView_Field_Post_Content GravityView_Field_Post_Custom_Field GravityView_Field_Post_ID GravityView_Field_Post_Image GravityView_Field_Post_Tags GravityView_Field_Post_Title GravityView_Field_Product GravityView_Field_Quantity GravityView_Field_Quiz GravityView_Field_Quiz_Score GravityView_Field_Radio GravityView_Field_Section GravityView_Field_Select GravityView_Field_Sequence GravityView_Field_Shipping GravityView_Field_Source_URL GravityView_Field_Survey GravityView_Field_Text GravityView_Field_Textarea GravityView_Field_Time GravityView_Field_Total GravityView_Field_Transaction_ID GravityView_Field_Transaction_Type GravityView_Field_Unsubscribe GravityView_Field_Username GravityView_Field_Website GravityView_Field_Workflow_Current_Status_Timestamp GravityView_Field_Workflow_Final_Status GravityView_Field_Workflow_Step GravityView_Post_Excerpt

Public Member Functions

 __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
 
 $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
 

Protected Member Functions

 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

 $_custom_merge_tag = false
 
 $_field_id = ''
 
 $_field_options = array()
 

Private Member Functions

 field_support_options ()
 

Detailed Description

Modify field settings by extending this class.

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

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

GravityView_Field constructor.

Modify the field options based on the name of the field type

See also
GravityView_Render_Settings::get_default_field_options

Auto-assign label from Gravity Forms label, if exists

Since
1.20

Definition at line 145 of file class-gravityview-field.php.

References gravityview(), and GravityView_Fields\register().

Member Function Documentation

◆ _filter_gform_custom_merge_tags()

_filter_gform_custom_merge_tags (   $custom_merge_tags = array(),
  $form_id = 0,
  $fields = array(),
  $element_id = '' 
)

Add custom merge tags to merge tag options.

DO NOT OVERRIDE.

Definition at line 362 of file class-gravityview-field.php.

References GV\$form, $form_id, custom_merge_tags(), and GVCommon\get_form().

◆ _filter_gform_replace_merge_tags()

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

DO NOT OVERRIDE.

See also
replace_merge_tag Override replace_merge_tag() to handle any matches
Since
1.16
Parameters
string$textText to replace
array$formGravity Forms form array
array$entryEntry array
bool$url_encodeWhether to URL-encode output
Returns
string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.

Definition at line 290 of file class-gravityview-field.php.

References $entry, GV\$form, and replace_merge_tag().

◆ _filter_sortable_fields()

_filter_sortable_fields (   $not_sortable)

Use field settings to modify whether a field is sortable.

See also
GravityView_frontend::is_field_sortable
Since
1.15.3
Parameters
array$not_sortableExisting field types that aren't sortable
Returns
array

Definition at line 406 of file class-gravityview-field.php.

References $name.

◆ add_entry_meta()

add_entry_meta (   $entry_meta)

Add the custom entry meta key to make it searchable and sortable.

See also
https://www.gravityhelp.com/documentation/article/gform_entry_meta/
Parameters
array$entry_metaArray of custom entry meta keys with associative arrays
Returns
mixed

Definition at line 424 of file class-gravityview-field.php.

References $entry_meta_update_callback, and gravityview().

◆ add_field_support()

add_field_support (   $key,
$field_options 
)

◆ add_sortable_field()

add_sortable_field (   $fields)

Add the field to the Filter & Sort available fields.

Since
1.19
Parameters
array$fieldsSub-set of GF form fields that are sortable
Returns
array Modified $fields array to include approval status in the sorting dropdown

Definition at line 242 of file class-gravityview-field.php.

◆ as_array()

as_array ( )

Returns the field as an array to be used in field pickers.

Since
2.10
Returns
array[]

Definition at line 191 of file class-gravityview-field.php.

References $gf_field, $icon, GV\description, and gravityview().

◆ custom_merge_tags()

custom_merge_tags (   $form = array(),
  $fields = array() 
)
protected

Add custom Merge Tags to Merge Tag options, if custom Merge Tags exist.

Should be overridden if there's more than one Merge Tag to add or if the Merge Tag isn't {_custom_merge_tag}

Since
1.16
Parameters
array$formGF Form array
GF_Field[]$fields Array of fields in the form
Returns
array Merge tag array with label and tag keys based on class label and _custom_merge_tag variables

Definition at line 383 of file class-gravityview-field.php.

Referenced by _filter_gform_custom_merge_tags().

◆ field_options()

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

Tap in here to modify field options.

Here's an example:

$field_options['name_display'] = array(
    'type' => 'select',
    'label' => __( 'User Format', 'gravityview' ),
    'desc' => __( 'How should the User information be displayed?', 'gravityview'),
    'choices' => array(
        array(
        'value' => 'display_name',
        'label' => __('Display Name (Example: "Ellen Ripley")', 'gravityview'),
    ),
    array(
        'value' => 'user_login',
        'label' => __('Username (Example: "nostromo")', 'gravityview')
    ),
     'value' => 'display_name'
);
Parameters
array$field_options[description]
string$template_id[description]
string$field_id[description]
string$context[description]
string$input_type[description]
Returns
array [description]

Definition at line 549 of file class-gravityview-field.php.

References $field_id.

◆ field_support_options()

field_support_options ( )
private
Runs Filter:
gravityview_date_format Override the date format with a PHP date format
Parameters
null | string$date_formatDate Format (default: null)
Runs Filter:
gravityview_field_support_options Modify the settings that a field supports
Parameters
array$optionsOptions multidimensional array with each key being the input name, with each array setting having type, label, desc and value (default values) keys

Definition at line 447 of file class-gravityview-field.php.

Referenced by add_field_support().

◆ is_choice_value_enabled()

is_choice_value_enabled ( )
protected

Check whether the enableChoiceValue flag is set for a GF field.

Gets the current form ID, gets the field at that ID, then checks for the enableChoiceValue value.

protected

GFAPI::get_form

Since
1.17
Returns
bool True: Enable Choice Value is active for field; False: not active, or form invalid, or form not found.

Definition at line 570 of file class-gravityview-field.php.

References $field, GV\$form, Utils\_POST(), gravityview(), gravityview_get_field(), and gravityview_get_form_id().

Referenced by GravityView_Field_Radio\field_options(), GravityView_Field_Select\field_options(), GravityView_Field_Checkbox\field_options(), and GravityView_Field_MultiSelect\field_options().

◆ replace_merge_tag()

replace_merge_tag (   $matches = array(),
  $text = '',
  $form = array(),
  $entry = array(),
  $url_encode = false,
  $esc_html = false 
)

Run GravityView filters when using GFCommon::replace_variables()

Instead of adding multiple hooks, add all hooks into this one method to improve speed

Since
1.8.4
See also
GFCommon::replace_variables()
Parameters
array$matchesArray of Merge Tag matches found in text by preg_match_all
string$textText to replace
array | bool$formGravity Forms form array. When called inside {
See also
GFCommon::replace_variables()} (now deprecated), false
Parameters
array | bool$entryEntry array. When called inside {
See also
GFCommon::replace_variables()} (now deprecated), false
Parameters
bool$url_encodeWhether to URL-encode output
bool$esc_htmlWhether to apply esc_html() to output
Returns
mixed

Definition at line 321 of file class-gravityview-field.php.

References $entry, and $value.

Referenced by _filter_gform_replace_merge_tags(), and GravityView_Field_Is_Approved\custom_merge_tags().

◆ set_default_search_label()

set_default_search_label (   $label = '',
  $gf_field = null,
  $field = array() 
)

Allow setting a default search label for search fields based on the field type.

Useful for entry meta "fields" that don't have Gravity Forms labels, like created_by

Since
1.17.3
Parameters
string$labelExisting label text, sanitized.
array$gf_fieldGravity Forms field array, as returned by GFFormsModel::get_field()
array$fieldField setting as sent by the GV configuration - has field, input (input type), and label keys
Returns
string

Definition at line 267 of file class-gravityview-field.php.

References $field, and $label.

Field Documentation

◆ $_custom_merge_tag

$_custom_merge_tag = false
protected

Definition at line 140 of file class-gravityview-field.php.

◆ $_field_id

$_field_id = ''
protected

◆ $_field_options

$_field_options = array()
protected

Definition at line 134 of file class-gravityview-field.php.

◆ $_gf_field_class_name

$_gf_field_class_name
Since
1.15.2
1.16.2.2 Changed access to public (previously, protected) string The name of a corresponding Gravity Forms GF_Field class, if exists

Definition at line 122 of file class-gravityview-field.php.

◆ $contexts

$contexts = array( 'single', 'multiple', 'edit', 'export' )

Definition at line 101 of file class-gravityview-field.php.

◆ $default_search_label

$default_search_label

Definition at line 36 of file class-gravityview-field.php.

◆ $description

$description

◆ $entry_meta_is_default_column

$entry_meta_is_default_column = false

Definition at line 90 of file class-gravityview-field.php.

◆ $entry_meta_key

$entry_meta_key = null

Definition at line 77 of file class-gravityview-field.php.

◆ $entry_meta_update_callback

$entry_meta_update_callback = null

Definition at line 84 of file class-gravityview-field.php.

Referenced by add_entry_meta().

◆ $group

$group

standard, advanced, post, pricing, meta, gravityview, or add-ons

Since
1.15.2 string The group belongs to this field in the field picker

Definition at line 44 of file class-gravityview-field.php.

◆ $icon

$icon = 'dashicons-admin-generic'

Definition at line 115 of file class-gravityview-field.php.

Referenced by as_array().

◆ $is_numeric

$is_numeric

boolean Is field content number-based?

Since
1.15.2

Definition at line 70 of file class-gravityview-field.php.

◆ $is_searchable

$is_searchable = true

Definition at line 51 of file class-gravityview-field.php.

◆ $is_sortable

$is_sortable = true

boolean Can the field be sorted in search?

Since
1.15.2

Definition at line 64 of file class-gravityview-field.php.

◆ $label

$label

◆ $name

$name

Definition at line 18 of file class-gravityview-field.php.

Referenced by _filter_sortable_fields().

◆ $search_operators

$search_operators

Definition at line 58 of file class-gravityview-field.php.


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