24 var
$icon =
'dashicons-text-page';
28 $this->label = esc_html__(
'Consent',
'gk-gravityview' );
30 parent::__construct();
32 add_filter(
'gravityview/template/field/consent/output', array( $this,
'field_output' ), 10, 2 );
43 public function field_output(
$output, $context ) {
45 $configuration = $context->field->as_configuration();
48 $consent_field = $context->field->field;
50 switch ( \
GV\Utils::get( $configuration,
'choice_display' ) ) {
52 return $consent_field->checked_indicator_markup;
55 $revision_id = absint( trim( $context->value[ $context->field->ID .
'.3' ] ) );
59 static $_consent_field_cache = array();
60 $_cache_key =
"{$consent_field->formId}_{$consent_field->ID}_{$revision_id}";
63 if ( ! empty( $_consent_field_cache[ $_cache_key ] ) ) {
64 return $_consent_field_cache[ $_cache_key ];
67 $description = $consent_field->get_field_description_from_revision( $revision_id );
98 $field_options = parent::field_options( $field_options, $template_id,
$field_id, $context, $input_type,
$form_id );
106 $field_options[
'choice_display'] = array(
108 'class' =>
'vertical',
109 'label' => __(
'What should be displayed:',
'gk-gravityview' ),
113 'both' => __(
'Consent image with description',
'gk-gravityview' ),
114 'tick' => __(
'Consent image',
'gk-gravityview' ),
115 'label' => __(
'Consent description',
'gk-gravityview' ),
118 'group' =>
'display',
121 return $field_options;
Modify field settings by extending this class.
new GravityView_Field_Consent
field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
Add choice_display setting to the field.
if(empty( $created_by)) $form_id
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed