You are here

function eu_cookie_compliance_store_consent in EU Cookie Compliance (GDPR Compliance) 7.2

Same name and namespace in other branches
  1. 7 eu_cookie_compliance.module \eu_cookie_compliance_store_consent()

Callback for the consent storage JSON call.

Parameters

string $type: The type of consent. 'banner' or form ID.

1 string reference to 'eu_cookie_compliance_store_consent'
eu_cookie_compliance_menu in ./eu_cookie_compliance.module
Implements hook_menu().

File

./eu_cookie_compliance.module, line 859
EU cookie compliance primary module file.

Code

function eu_cookie_compliance_store_consent($type) {
  ctools_include('plugins');
  $type = check_plain($type);
  $consent_storage_method = eu_cookie_compliance_get_settings('consent_storage_method');
  if ($consent_storage_method === 'do_not_store' || $consent_storage_method === '') {
    drupal_json_output(NULL);
    drupal_exit();
  }

  // Get plugin.
  $consent_storage_plugin = ctools_get_plugins('eu_cookie_compliance', 'consent_storage', $consent_storage_method);
  if (!empty($consent_storage_plugin['consent_storage_callback'])) {
    $consent_storage_function = $consent_storage_plugin['consent_storage_callback'];
    if ($consent_storage_function !== '') {
      $result = $consent_storage_function($type);
      drupal_json_output($result);
      drupal_exit();
    }
  }
  drupal_json_output(NULL);
  drupal_exit();
}