Skip to main content

GravityKit\GravityMigrate\Schema\GfConsentField

Builds the parts a Gravity Forms consent field needs to store a value.

A consent field is not a plain checkbox. GF_Field_Consent writes three inputs: .1 holds whether the box was ticked, .2 records the consent text as it read at submission, and .3 records the form revision that text came from. Its single choice is "Checked" with value 1, and the text beside the box lives in checkboxLabel.

Without the choice and all three inputs the field cannot store what a submitter agreed to, which is the whole reason the field exists.

Since: %ver%

Source: src/Schema/GfConsentField.php:23

Details

  • Kind: class
  • Namespace: GravityKit\GravityMigrate\Schema

Methods

MethodDescription
build()Returns the field properties a consent field needs.

Method Reference

build()

public static function build( int $field_id, string $checkbox_label, bool $is_checked=false ): array

Returns the field properties a consent field needs.

Parameters

NameTypeDefaultDescription
$field_idintGravity Forms field id.
$checkbox_labelstringText shown beside the checkbox.
$is_checkedboolfalseWhether the box starts ticked.

Returns

  • array

Since: %ver%

Source: src/Schema/GfConsentField.php:36