GravityView
2.17
The best, easiest way to display Gravity Forms entries on your website.
|
Add custom options for date fields. More...
Public Member Functions | |
__construct () | |
GravityView_Field_Time constructor. More... | |
_filter_date_display_date_format () | |
Modify the default PHP date formats used by the time field based on the field IDs and the field settings. More... | |
_maybe_filter_gravity_forms_query ( $criteria, $form_ids, $view_id) | |
If the sorting key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL. More... | |
_modify_query_sort_by_time_hack ( $query) | |
Modify Gravity Forms query SQL to convert times to numbers Gravity Forms couldn't sort by time...until NOW. More... | |
field_options ( $field_options, $template_id, $field_id, $context, $input_type, $form_id) | |
modify_sort_id ( $sort_field_id, $form_id) | |
Modify the sort key for the time field so it can be parsed by the query filter. 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... | |
Static Public Member Functions | |
static | _get_time_format_for_field ( $field_id, $form_id=0) |
Return the field's time format by fetching the form ID and checking the field settings. More... | |
static | date_format ( $time_format='12', $field_id=0) |
Get the default date format for a field based on the field ID and the time format setting. More... | |
Data Fields | |
$_gf_field_class_name = 'GF_Field_Time' | |
$group = 'advanced' | |
$icon = 'dashicons-clock' | |
$is_numeric | |
$is_searchable = true | |
$name = 'time' | |
$search_operators = array( 'is', 'isnot', 'greater_than', 'less_than' ) | |
const | GF_SORTING_SQL = 'SELECT 0 as query, lead_id as id, value' |
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 | |
_get_time_format () | |
Return the field's time format by fetching the form ID and checking the field settings. More... | |
Private Attributes | |
$_date_format = null | |
$_sort_divider = '|:time:|' | |
$_time_format = null | |
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() | |
Add custom options for date fields.
Definition at line 11 of file class-gravityview-field-time.php.
__construct | ( | ) |
GravityView_Field_Time constructor.
Definition at line 59 of file class-gravityview-field-time.php.
_filter_date_display_date_format | ( | ) |
Modify the default PHP date formats used by the time field based on the field IDs and the field settings.
Definition at line 272 of file class-gravityview-field-time.php.
References GravityView_Field\$_field_id, $field_id, and _get_time_format().
|
private |
Return the field's time format by fetching the form ID and checking the field settings.
Definition at line 228 of file class-gravityview-field-time.php.
References $current_form, $post, and gravityview_get_form_id().
Referenced by _filter_date_display_date_format().
|
static |
Return the field's time format by fetching the form ID and checking the field settings.
string | $field_id | ID for Gravity Forms time field |
int | $form_id | ID for Gravity Forms form |
Definition at line 245 of file class-gravityview-field-time.php.
_maybe_filter_gravity_forms_query | ( | $criteria, | |
$form_ids, | |||
$view_id | |||
) |
If the sorting key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL.
array | $criteria | Search criteria used by GravityView |
array | $form_ids | Forms to search |
int | $view_id | ID of the view being used to search |
is_numeric
to true and make sure the field ID is an int If the sort key does not match the key set in modify_sort_id(), do not modify the Gravity Forms query SQL
Make sure sorting is numeric (# of seconds). IMPORTANT.
Definition at line 105 of file class-gravityview-field-time.php.
References $criteria.
_modify_query_sort_by_time_hack | ( | $query | ) |
Modify Gravity Forms query SQL to convert times to numbers Gravity Forms couldn't sort by time...until NOW.
string | $query | MySQL query |
If this is a Gravity Forms entry selection sorting query, generated by sort_by_field_query(), then we want to modify the query.
Convert the time (12:30 pm) to the MySQL TIME_TO_SEC()
value for that time (45000) This way, Gravity Forms is able to sort numerically.
Replace it in the main query
REMOVE the Gravity Forms WP Query modifications!
Definition at line 150 of file class-gravityview-field-time.php.
|
static |
Get the default date format for a field based on the field ID and the time format setting.
string | $time_format | The time format ("12" or "24"). Default: "12" { |
int | $field_id | The ID of the field. Used to figure out full time/hours/minutes/am/pm { |
Definition at line 290 of file class-gravityview-field-time.php.
References $field_id, and gravityview_get_input_id_from_id().
field_options | ( | $field_options, | |
$template_id, | |||
$field_id, | |||
$context, | |||
$input_type, | |||
$form_id | |||
) |
Set default date format based on field ID and Form ID
Definition at line 200 of file class-gravityview-field-time.php.
References $field_id, $form_id, and GravityView_Field\add_field_support().
modify_sort_id | ( | $sort_field_id, | |
$form_id | |||
) |
Modify the sort key for the time field so it can be parsed by the query filter.
string | $sort_field_id | Existing sort field ID (like "5") |
int | $form_id | Gravity Forms Form ID being sorted |
5|:time:|12|:time:|h:i A
Definition at line 81 of file class-gravityview-field-time.php.
References $form_id.
|
private |
Definition at line 54 of file class-gravityview-field-time.php.
$_gf_field_class_name = 'GF_Field_Time' |
Definition at line 20 of file class-gravityview-field-time.php.
|
private |
Definition at line 42 of file class-gravityview-field-time.php.
|
private |
Definition at line 48 of file class-gravityview-field-time.php.
$group = 'advanced' |
Definition at line 22 of file class-gravityview-field-time.php.
$icon = 'dashicons-clock' |
Definition at line 24 of file class-gravityview-field-time.php.
$is_numeric |
Definition at line 30 of file class-gravityview-field-time.php.
$is_searchable = true |
Definition at line 15 of file class-gravityview-field-time.php.
$name = 'time' |
Definition at line 13 of file class-gravityview-field-time.php.
$search_operators = array( 'is', 'isnot', 'greater_than', 'less_than' ) |
Definition at line 17 of file class-gravityview-field-time.php.
const GF_SORTING_SQL = 'SELECT 0 as query, lead_id as id, value' |
Definition at line 36 of file class-gravityview-field-time.php.