GF_Field_Consent
The Consent Field keeps track of exactly what the user consented to. The consent value ("1"), checkbox label and the Form revision ID
are all stored in the entry meta table in separate input values when consent is given.
Since: 2.4 (Class GF_Field_Consent)
Source: includes/fields/class-gf-field-consent.php:15
Details
- Kind:
class - Namespace:
(global) - Extends: GF_Field
Properties
| Property | Type | Description |
|---|---|---|
$type | string | Declare the field type. |
$duplicatable | bool | Whether there can be more than one of this field type per form. |
$repeatable | bool | Whether the field can be used in a repeater. Consent field is currently not supported in repeaters. |
$checked_indicator_url | string | Checked indicator URL. |
$checked_indicator_markup | string | Checked indicator image markup. |
$_supports_state_validation | bool | Indicates if this field supports state validation. |
Methods
| Method | Description |
|---|---|
__construct() | GF_Field_Consent constructor. |
get_form_editor_field_title() | Returns the field title. |
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_button() | Returns the field button properties for the form editor. The array contains two elements: |
get_form_editor_field_settings() | Returns the class names of the settings which should be available on the field in the form editor. |
is_conditional_logic_supported() | Indicate if this field type can be used when configuring conditional logic rules. |
get_field_container_tag() | Returns the HTML tag for the field container. |
get_field_input() | Returns the field inner markup. |
get_first_input_id() | Returns the input ID to be assigned to the field label for attribute. |
get_description() | Returns the markup for the field description. |
get_aria_describedby() | If a field has a description, the aria-describedby attribute for the input field is returned. |
is_value_submission_empty() | Used when determining if the field has failed required validation. |
get_value_save_input() | Sanitize and format the value before it is saved to the Entry Object. |
get_value_merge_tag() | Set the values of consent field inputs in merge tags. |
get_value_entry_list() | Format the entry value for display on the entries list page. |
get_value_entry_detail() | Format the entry value for display on the entry detail page and for the {all_fields} merge tag. |
get_value_export() | Format the entry value before it is used in entry exports and by framework add-ons using GFAddOn::get_field_value(). |
sanitize_settings() | Forces settings into expected values while saving the form object. |
get_filter_settings() | Returns the filter settings for the current field. |
get_filter_operators() | Returns the filter operators for the current field. |
get_filter_values() | Returns the filters values setting for the current field. |
get_field_description_from_revision() | Get consent description from the form revision. |
skip_state_validation_if_blank() | Indicates if state validation should be skipped if the submitted value is blank. |
get_values_for_state_hash() | Prepares the value that will be hashed on form display as part of the state. |
Method Reference
__construct()
public function __construct( $data=[] )
GF_Field_Consent constructor.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$data | array | [] | Data needed when initiate the class. |
Since: 2.4
Source: includes/fields/class-gf-field-consent.php:78
get_form_editor_field_title()
public function get_form_editor_field_title()
Returns the field title.
Returns
string
Since: 2.4
Source: includes/fields/class-gf-field-consent.php:107
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-consent.php:118
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-consent.php:131
get_form_editor_button()
public function get_form_editor_button()
Returns the field button properties for the form editor. The array contains two elements:
'group' => 'standard_fields' // or 'advanced_fields', 'post_fields', 'pricing_fields' 'text' => 'Button text'
Returns
array
Since: 2.4
Source: includes/fields/class-gf-field-consent.php:144
get_form_editor_field_settings()
public function get_form_editor_field_settings()
Returns the class names of the settings which should be available on the field in the form editor.
Returns
array
Since: 2.4
Source: includes/fields/class-gf-field-consent.php:158
is_conditional_logic_supported()
public function is_conditional_logic_supported()
Indicate if this field type can be used when configuring conditional logic rules.
Returns
bool
Since: 2.4
Source: includes/fields/class-gf-field-consent.php:180
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-consent.php:193
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 | 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: 2.4
Source: includes/fields/class-gf-field-consent.php:214
get_first_input_id()
public function get_first_input_id( $form )
Returns the input ID to be assigned to the field label for attribute.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form Object currently being processed. |
Returns
string
Since: 2.4
Source: includes/fields/class-gf-field-consent.php:274
get_description()
public function get_description( $description, $css_class )
Returns the markup for the field description.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$description | string | The field description. | |
$css_class | string | The css class to be assigned to the description container. |
Returns
string
Since: 2.4
Source: includes/fields/class-gf-field-consent.php:290
get_aria_describedby()
public function get_aria_describedby( $extra_ids=[] )
If a field has a description, the aria-describedby attribute for the input field is returned.
This method is specific to the consent field since the consent description has a different ID pattern.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$extra_ids | array | string | [] | Any extra ids that should be added to the describedby attribute. |
Returns
string
Since: 2.6.8
Source: includes/fields/class-gf-field-consent.php:312
is_value_submission_empty()
public function is_value_submission_empty( $form_id )
Used when determining if the field has failed required validation.
The consent field has three inputs; only the checkbox is required.