GF_Field_Time
Class GF_Field_Time
Handles Time fields.
Since: Unknown
Source: includes/fields/class-gf-field-time.php:16
Details
- Kind:
class - Namespace:
(global) - Extends: GF_Field
Properties
| Property | Type | Description |
|---|---|---|
$type | string | The type of field this is. |
Methods
| Method | Description |
|---|---|
get_form_editor_field_title() | Sets the title of the field to be used in the form editor. |
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_form_editor_field_settings() | Defines the field editor settings that are available for this field. |
get_required_inputs_ids() | Defines the IDs of required inputs. |
get_default_properties() | Get the default properties. |
validate() | Validates the 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() | Defines how the Time field input is shown. |
is_value_submission_array() | Whether this field expects an array during submission. |
is_value_submission_empty() | Determines if any of the submission values are empty. |
is_value_empty() | Determines whether the given value is considered empty for this field. |
get_value_save_input() | Sanitize and format the value before it is saved to the Entry Object. |
get_form_inline_script_on_page_render() | Returns a JS script to be rendered in the front end of the form. |
get_form_editor_inline_script_on_page_render() | Returns the scripts to be included for this field type in the form editor. |
get_entry_inputs() | Overrides GF_Field to prevent the standard input ID from being used. |
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. |
sanitize_settings() | Sanitizes settings for the Time field. |
Method Reference
get_form_editor_field_title()
public function get_form_editor_field_title()
Sets the title of the field to be used in the form editor.
Returns
string— The field title.
Since: Unknown
Source: includes/fields/class-gf-field-time.php:42
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-time.php:53
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-time.php:66
get_form_editor_field_settings()
function get_form_editor_field_settings()
Defines the field editor settings that are available for this field.
Returns
array— Contains the settings available within the field editor.
Since: Unknown
Source: includes/fields/class-gf-field-time.php:80
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-time.php:108
get_default_properties()
public function get_default_properties()
Get the default properties.
Inputs are required for the field to function correctly, so this ensures that the inputs exist.
Returns
array[]— Array of default properties.
Since: 2.7.4
Source: includes/fields/class-gf-field-time.php:121
validate()
public function validate( $value, $form )
Validates the field inputs.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | array | string | The field value or values to validate. | |
$form | array | The Form Object. |
Returns
void
Since:
1.92.5.6(Updated to use set_required_error().)
Source: includes/fields/class-gf-field-time.php:162
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-time.php:203
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-time.php:220
get_field_input()
public function get_field_input( $form, $value='', $entry=null )
Defines how the Time field input is shown.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form Object. | |
$value | string | '' | The field default value. Defaults to empty string. |
$entry | array | null | null | The Entry Object, if available. Defaults to null. |
Returns
string— The field HTML markup.
Since: Unknown
Source: includes/fields/class-gf-field-time.php:250
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-time.php:395
is_value_submission_empty()
public function is_value_submission_empty( $form_id )
Determines if any of the submission values are empty.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form_id | int | The form ID. |
Returns
bool— True if empty. False otherwise.
Since: Unknown
Source: includes/fields/class-gf-field-time.php:411
is_value_empty()
public function is_value_empty( $value )
Determines whether the given value is considered empty for this field.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | array | The value. |
Returns
bool— True if empty. False otherwise.
Since: 2.4
Source: includes/fields/class-gf-field-time.php:433
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-time.php:461
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-time.php:510
get_form_editor_inline_script_on_page_render()
public function get_form_editor_inline_script_on_page_render()
Returns the scripts to be included for this field type in the form editor.
Returns
string
Since: 2.6
Source: includes/fields/class-gf-field-time.php:528
get_entry_inputs()
public function get_entry_inputs()
Overrides GF_Field to prevent the standard input ID from being used.
Returns
null
Since: Unknown
Source: includes/fields/class-gf-field-time.php:541
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-time.php:556
sanitize_settings()
public function sanitize_settings()
Sanitizes settings for the Time field.
Returns
void
Since: Unknown
Source: includes/fields/class-gf-field-time.php:573