GF_Field_Date
Source: includes/fields/class-gf-field-date.php:8
Details
- Kind:
class - Namespace:
(global) - Extends: GF_Field
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. |
is_value_submission_array() | Whether this field expects an array during submission. |
validate() | Validates the date field inputs. |
prepare_complex_validation_value() | Updates the value to use the input ids as the keys before it's used to generate the complex validation message. |
get_field_container_tag() | Returns the HTML tag for the field container. |
get_field_input() | Returns the field inner markup. |
get_field_label_class() | Get field label class. |
get_date_array_by_format() | The default value for mulit-input date fields will always be an array in mdy order |
get_value_entry_detail() | Format the entry value for display on the entry detail page and for the {all_fields} merge tag. |
get_value_merge_tag() | Gets merge tag values. |
get_output_date_format() | Returns the date format to use when outputting the entry value on the detail page and when merge tags are processed. |
get_form_inline_script_on_page_render() | Returns a JS script to be rendered in the front end of the form. |
get_input_label() | Return the custom label for an input. |
get_input_placeholder_value() | When no placeholder is set, use the date format as the placeholder. |
get_field_placeholder_attribute() | If the field placeholder property has a value return the input placeholder attribute. |
get_value_save_input() | Sanitize and format the value before it is saved to the Entry Object. |
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_settings() | Returns the filter settings for the current field. |
post_convert_field() | Upgrades inputs, if needed. |
maybe_update_inputs() | The datefield and datedropdown date field input types can wind up |
get_input_property() | Gets a property value from an input. |
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-date.php:23
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-date.php:36
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-date.php:47
is_value_submission_array()
public function is_value_submission_array()
Whether this field expects an array during submission.
Returns
bool
Since: 2.4
Source: includes/fields/class-gf-field-date.php:79
validate()
public function validate( $value, $form )
Validates the date 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:
1.92.6.5(Updated to use set_required_error().)
Source: includes/fields/class-gf-field-date.php:94
prepare_complex_validation_value()
public function prepare_complex_validation_value( $value )
Updates the value to use the input ids as the keys before it's used to generate the complex validation message.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | array | The value to be prepared. |
Returns
array
Since: 2.6.5
Source: includes/fields/class-gf-field-date.php:148
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-date.php:177
get_field_input()
public function get_field_input( $form, $value='', $entry=null )
Returns the field inner markup.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form Object currently being processed. | |
$value | string | array | '' | The field value. From default/dynamic population, $_POST, or a resumed incomplete submission. |
$entry | null | array | null | Null or the Entry Object currently being edited. |
Returns
string
Since:
unknown2.5(Added accessibility improvements.)
Source: includes/fields/class-gf-field-date.php:199
get_field_label_class()
public function get_field_label_class()
Get field label class.
Returns
string
Since:
unknown2.5(Addedscreen-reader-textif the label hasn't been set; addedgfield_label_before_complexif it is datefield.)2.7(Addedgform-field-labelfor the theme framework.)
Source: includes/fields/class-gf-field-date.php:517
get_date_array_by_format()
public function get_date_array_by_format( $value )
The default value for mulit-input date fields will always be an array in mdy order
this code will alter the order of the values to the date format of the field
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value |
Source: includes/fields/class-gf-field-date.php:560
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:
1.92.9.29(Changed the second parameter $currency (string) to $entry (array).)
Source: includes/fields/class-gf-field-date.php:595
get_value_merge_tag()
public function get_value_merge_tag( $value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br )
Gets merge tag values.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | array | string | The value of the input. | |
$input_id | string | The input ID to use. | |
$entry | array | The Entry Object. | |
$form | array | The Form Object | |
$modifier | string | The modifier passed. | |
$raw_value | array | string | The raw value of the input. | |
$url_encode | bool | If the result should be URL encoded. | |
$esc_html | bool | If the HTML should be escaped. | |
$format | string | The format that the value should be. | |
$nl2br | bool | If the nl2br function should be used. |
Returns
string— The processed merge tag.
Since: Unknown
Source: includes/fields/class-gf-field-date.php:622
get_output_date_format()
public function get_output_date_format()
Returns the date format to use when outputting the entry value on the detail page and when merge tags are processed.
Returns
string
Since: 2.4
Source: includes/fields/class-gf-field-date.php:634
get_form_inline_script_on_page_render()
public function get_form_inline_script_on_page_render( $form )
Returns a JS script to be rendered in the front end of the form.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form Object |
Returns
string— Returns a JS script to be processed in the front end.
Source: includes/fields/class-gf-field-date.php:672
get_input_label()
public function get_input_label( $input )
Return the custom label for an input.
Theoretically the label is for what to fill out and the placeholder is for how to fill it out.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$input | array | string | The input object or the input id. |
Returns
string
Since: 2.5
Source: includes/fields/class-gf-field-date.php:920
get_input_placeholder_value()
public function get_input_placeholder_value( $input )
When no placeholder is set, use the date format as the placeholder.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$input | array | The input object. |
Returns
string
Since: 2.5
Source: includes/fields/class-gf-field-date.php:969
get_field_placeholder_attribute()
public function get_field_placeholder_attribute()
If the field placeholder property has a value return the input placeholder attribute.
Returns
string
Since: 2.5
Source: includes/fields/class-gf-field-date.php:984
get_value_save_input()
public function get_value_save_input( $value, $form, $input_name, $entry_id, $entry, $repeater_index='' )
Sanitize and format the value before it is saved to the Entry Object.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | The value to be saved. | |
$form | array | The Form object currently being processed. | |
$input_name | string | The input name used when accessing the $_POST. | |
$entry_id | int | The ID of the entry currently being processed. | |
$entry | array | The entry currently being processed. | |
$repeater_index | string | '' | The repeater index if the field is inside a repeater. |
Returns
array|string— The sanitized and formatted input value to be saved.
Since: 3.0.0
Source: includes/fields/class-gf-field-date.php:1008
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-date.php:1044
get_filter_settings()
public function get_filter_settings()
Returns the filter settings for the current field.
Returns
array
Since: 2.4
Source: includes/fields/class-gf-field-date.php:1057
post_convert_field()
public function post_convert_field()
Upgrades inputs, if needed.
Returns
void
See Also
Since: 2.5.7
Source: includes/fields/class-gf-field-date.php:1077
maybe_update_inputs()
public function maybe_update_inputs()
The datefield and datedropdown date field input types can wind up
in a state where the field's inputs are not set. This performs a check for the existence of the necessary inputs and updates the field to have them if they do not.
Since: 2.5.7
Source: includes/fields/class-gf-field-date.php:1090
get_input_property()
public function get_input_property( $input_id, $property_name )
Gets a property value from an input.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$input_id | int | The input ID to obtain the property from. | |
$property_name | string | The property name to search for. |
Returns
null|string— The property value if found. Otherwise, null.
Since: 2.9.31
Source: includes/fields/class-gf-field-date.php:1136