You are here

public function PersonalInformationFormTrait::formSubmitGdprCheckbox in EU Cookie Compliance (GDPR Compliance) 8

Same name and namespace in other branches
  1. 2.0.x src/PersonalInformationFormTrait.php \Drupal\eu_cookie_compliance\PersonalInformationFormTrait::formSubmitGdprCheckbox()

Process form submission in regards to GDPR checkbox.

Parameters

array $form: Form structure.

\Drupal\Core\Form\FormStateInterface $form_state: Form state with the submitted values.

File

src/PersonalInformationFormTrait.php, line 70

Class

PersonalInformationFormTrait
Trait that implements PersonalInformationFormInterface.

Namespace

Drupal\eu_cookie_compliance

Code

public function formSubmitGdprCheckbox(array $form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('eu_compliance_cookie') && $this
    ->getConsentStorage()) {
    $this
      ->getConsentStorage()
      ->registerConsent($this
      ->getFormId());
  }
}