You are here

protected function PersonalInformationFormTrait::getConsentStorage 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::getConsentStorage()

Get active consent storage.

Return value

null|\Drupal\eu_cookie_compliance\Plugin\ConsentStorageBase Consent storage object or NULL if one is not configured/available.

Throws

\Drupal\Component\Plugin\Exception\PluginException

1 call to PersonalInformationFormTrait::getConsentStorage()
PersonalInformationFormTrait::formSubmitGdprCheckbox in src/PersonalInformationFormTrait.php
Process form submission in regards to GDPR checkbox.

File

src/PersonalInformationFormTrait.php, line 126

Class

PersonalInformationFormTrait
Trait that implements PersonalInformationFormInterface.

Namespace

Drupal\eu_cookie_compliance

Code

protected function getConsentStorage() {
  $storage_manager = $this->consentStorageManager ? $this->consentStorageManager : \Drupal::service('plugin.manager.eu_cookie_compliance.consent_storage');
  $active_storage = $this
    ->getConfig('eu_cookie_compliance.settings')
    ->get('consent_storage_method');
  if ($active_storage && $storage_manager
    ->hasDefinition($active_storage)) {
    return $storage_manager
      ->createInstance($active_storage);
  }
  return NULL;
}