TYPO3 Logo
Form consent
Release: 2.0

Loading data.

  • Introduction
  • Installation
  • Configuration
    • Form finisher configuration
    • TypoScript configuration
    • Extension configuration
  • Usage
    • Consent finisher
    • Validation plugin
    • Scheduler task
    • Dashboard widget
  • Developer corner
    • Configuration API
    • Consent factory
    • Events
    • JSON type
  • Migration
  • Contributing
  • Sitemap
  • Index

PAGE CONTENTS

  • Consent finisher
    • Example
    • Invoke finishers on consent approval or dismissal
      • Requirements
      • Example
  1. Start
  2. Usage
  3. Consent finisher
View source How to edit Edit on GitHub

Display settings


Color scheme of code blocks:


Consent finisher¶

A new finisher Consent is available in the backend form editor. It saves all submitted form data in the database and sends a corresponding mail to either approve or dismiss a given consent.

Tip

The last inserted consent is populated with the finisher variable provider. It can be accessed as {Consent.lastInsertedConsent} in the .form.yaml configuration.

Form editor with consent finisher options

Example¶

finishers:
  -
    identifier: Consent
    options:
      subject: 'Please approve your subscription'
      recipientAddress: '{email}'
      recipientName: '{first-name} {last-name}'
      senderAddress: ''
      senderName: ''
      approvalPeriod: '86400'
      showDismissLink: true
      confirmationPid: '277'
      storagePid: '276'
  -
    identifier: SaveToDatabase
    options:
      table: tx_myextension_domain_model_subscription
      mode: insert
      databaseColumnMappings:
        consent:
          # References the consent uid
          value: '{Consent.lastInsertedConsent.uid}'

See also

Read more about all available finisher options in Form finisher configuration.

Invoke finishers on consent approval or dismissal¶

After a user has given or revoked consent, it is often necessary to execute certain form finishers. For example, to send an admin email or redirect to a specific page.

To achieve this, after the user gives or revokes consent, the originally completed form is resubmitted. During this resubmission of the form, the selected finishers can now be overwritten using the isConsentApproved() or isConsentDismissed() conditions in a form variant.

Requirements¶

The following requirements must be met for the form to be resubmitted:

  1. Form variant at the root level of the form must exist

  2. Form variant must redefine the finishers used

  3. Conditions isConsentApproved() or isConsentDismissed() must exist in the variant

Example¶

The following form variant is stored directly on the root level of the form definition (that is, your .form.yaml file). It specifies the form finishers to be executed in case of successful approval by the user.

variants:
  -
    identifier: post-consent-approval-variant-1
    condition: 'isConsentApproved()'
    finishers:
      -
        identifier: EmailToReceiver
        options:
          # ...
      -
        identifier: Redirect
        options:
          # ...

In this example, an admin email would be sent after the consent has been given and a redirect to the configured confirmation page would take place.

The same behavior can be achieved in case the user revokes his consent. The condition isConsentDismissed() must then be used instead.

  • Previous
  • Next
  • Home
  • Contact
  • Issues
  • Repository

Page last updated: Jan 22, 2024 16:40

Last rendered: Jan 22, 2024 16:41

  • TYPO3 Theme 4.9.0
  • DRC v3.2.1
© Copyright since 2021 by Elias Häußler
  • Legal Notice
  • Privacy Policy
  • Code of Conduct