Skip to main content

GF_Field_Date

Source: includes/fields/class-gf-field-date.php:8

Details

  • Kind: class
  • Namespace: (global)
  • Extends: GF_Field

Methods

MethodDescription
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

NameTypeDefaultDescription
$valuestring | arrayThe field value from get_value_submission().
$formarrayThe Form Object currently being processed.

Returns

  • void

Since:

  • 1.9
  • 2.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

NameTypeDefaultDescription
$valuearrayThe 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

NameTypeDefaultDescription
$formarrayThe 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

NameTypeDefaultDescription
$formarrayThe Form Object currently being processed.
$valuestring | array''The field value. From default/dynamic population, $_POST, or a resumed incomplete submission.
$entrynull | arraynullNull or the Entry Object currently being edited.

Returns

  • string

Since:

  • unknown
  • 2.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:

  • unknown
  • 2.5 (Added screen-reader-text if the label hasn't been set; added gfield_label_before_complex if it is datefield.)
  • 2.7 (Added gform-field-label for 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

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

NameTypeDefaultDescription
$valuestring | arrayThe field value.
$entryarray[]The entry.
$use_textbool | falsefalseWhen processing choice based fields should the choice text be returned instead of the value.
$formatstring'html'The format requested for the location the merge is being used. Possible values: html, text or url.
$mediastring'screen'The location where the value will be displayed. Possible values: screen or email.

Returns

  • string

Since:

  • 1.9
  • 2.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

NameTypeDefaultDescription
$valuearray | stringThe value of the input.
$input_idstringThe input ID to use.
$entryarrayThe Entry Object.
$formarrayThe Form Object
$modifierstringThe modifier passed.
$raw_valuearray | stringThe raw value of the input.
$url_encodeboolIf the result should be URL encoded.
$esc_htmlboolIf the HTML should be escaped.
$formatstringThe format that the value should be.
$nl2brboolIf 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

NameTypeDefaultDescription
$formarrayThe 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

NameTypeDefaultDescription
$inputarray | stringThe 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

NameTypeDefaultDescription
$inputarrayThe 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

NameTypeDefaultDescription
$valuestringThe value to be saved.
$formarrayThe Form object currently being processed.
$input_namestringThe input name used when accessing the $_POST.
$entry_idintThe ID of the entry currently being processed.
$entryarrayThe entry currently being processed.
$repeater_indexstring''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

NameTypeDefaultDescription
$formarrayThe 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

NameTypeDefaultDescription
$input_idintThe input ID to obtain the property from.
$property_namestringThe 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