Add only required cookies option
This commit is contained in:
@ -49,11 +49,11 @@ class GdprCookieConsent extends Module
|
||||
Configuration::updateValue('GDPR_COOKIE_SETTINGS', 'Cookie Settings') &&
|
||||
Configuration::updateValue('GDPR_COOKIE_MORE_INFO', 'More Information') &&
|
||||
Configuration::updateValue('GDPR_COOKIE_MORE_INFO_URL', 'content/2-privacy-policy') &&
|
||||
// New configuration values
|
||||
Configuration::updateValue('GDPR_COOKIE_DATA_CONTROLLER', 'Your Company Name') &&
|
||||
Configuration::updateValue('GDPR_COOKIE_RETENTION_PERIOD', '365 days') &&
|
||||
Configuration::updateValue('GDPR_COOKIE_THIRD_PARTIES', 'Google Analytics, Facebook, etc.') &&
|
||||
Configuration::updateValue('GDPR_COOKIE_MANAGE_TEXT', 'Manage Cookie Preferences');
|
||||
Configuration::updateValue('GDPR_COOKIE_MANAGE_TEXT', 'Manage Cookie Preferences') &&
|
||||
Configuration::updateValue('GDPR_COOKIE_ONLY_REQUIRED', 1);
|
||||
}
|
||||
|
||||
|
||||
@ -70,11 +70,11 @@ class GdprCookieConsent extends Module
|
||||
Configuration::deleteByName('GDPR_COOKIE_SETTINGS') &&
|
||||
Configuration::deleteByName('GDPR_COOKIE_MORE_INFO') &&
|
||||
Configuration::deleteByName('GDPR_COOKIE_MORE_INFO_URL') &&
|
||||
// New configuration values
|
||||
Configuration::deleteByName('GDPR_COOKIE_DATA_CONTROLLER') &&
|
||||
Configuration::deleteByName('GDPR_COOKIE_RETENTION_PERIOD') &&
|
||||
Configuration::deleteByName('GDPR_COOKIE_THIRD_PARTIES') &&
|
||||
Configuration::deleteByName('GDPR_COOKIE_MANAGE_TEXT');
|
||||
Configuration::deleteByName('GDPR_COOKIE_MANAGE_TEXT') &&
|
||||
Configuration::deleteByName('GDPR_COOKIE_ONLY_REQUIRED');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,6 +94,11 @@ class GdprCookieConsent extends Module
|
||||
$settings = Tools::getValue('GDPR_COOKIE_SETTINGS');
|
||||
$moreInfo = Tools::getValue('GDPR_COOKIE_MORE_INFO');
|
||||
$moreInfoUrl = Tools::getValue('GDPR_COOKIE_MORE_INFO_URL');
|
||||
$dataController = Tools::getValue('GDPR_COOKIE_DATA_CONTROLLER');
|
||||
$retentionPeriod = Tools::getValue('GDPR_COOKIE_RETENTION_PERIOD');
|
||||
$thirdParties = Tools::getValue('GDPR_COOKIE_THIRD_PARTIES');
|
||||
$manageText = Tools::getValue('GDPR_COOKIE_MANAGE_TEXT');
|
||||
$onlyRequired = Tools::getValue('GDPR_COOKIE_ONLY_REQUIRED');
|
||||
|
||||
// Update configuration values
|
||||
Configuration::updateValue('GDPR_COOKIE_ENABLED', $enabled);
|
||||
@ -103,6 +108,11 @@ class GdprCookieConsent extends Module
|
||||
Configuration::updateValue('GDPR_COOKIE_SETTINGS', $settings);
|
||||
Configuration::updateValue('GDPR_COOKIE_MORE_INFO', $moreInfo);
|
||||
Configuration::updateValue('GDPR_COOKIE_MORE_INFO_URL', $moreInfoUrl);
|
||||
Configuration::updateValue('GDPR_COOKIE_DATA_CONTROLLER', $dataController);
|
||||
Configuration::updateValue('GDPR_COOKIE_RETENTION_PERIOD', $retentionPeriod);
|
||||
Configuration::updateValue('GDPR_COOKIE_THIRD_PARTIES', $thirdParties);
|
||||
Configuration::updateValue('GDPR_COOKIE_MANAGE_TEXT', $manageText);
|
||||
Configuration::updateValue('GDPR_COOKIE_ONLY_REQUIRED', $onlyRequired);
|
||||
|
||||
// Display confirmation
|
||||
$output .= $this->displayConfirmation($this->l('Settings updated'));
|
||||
@ -208,6 +218,26 @@ class GdprCookieConsent extends Module
|
||||
'name' => 'GDPR_COOKIE_MORE_INFO_URL',
|
||||
'required' => true,
|
||||
],
|
||||
[
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('This cookie types are used'),
|
||||
'name' => 'GDPR_COOKIE_ONLY_REQUIRED',
|
||||
'desc' => $this->l('If this option is enabled, no config modal will be rendered and there will only be a single button to hide the cookie notice. (Only enable this, if you don\'t track any user data)'),
|
||||
'is_bool' => true,
|
||||
'required' => true,
|
||||
'values' => [
|
||||
[
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Nessessary only')
|
||||
],
|
||||
[
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('All cookies')
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
'submit' => [
|
||||
'title' => $this->l('Save'),
|
||||
@ -242,11 +272,11 @@ class GdprCookieConsent extends Module
|
||||
$helper->fields_value['GDPR_COOKIE_SETTINGS'] = Configuration::get('GDPR_COOKIE_SETTINGS');
|
||||
$helper->fields_value['GDPR_COOKIE_MORE_INFO'] = Configuration::get('GDPR_COOKIE_MORE_INFO');
|
||||
$helper->fields_value['GDPR_COOKIE_MORE_INFO_URL'] = Configuration::get('GDPR_COOKIE_MORE_INFO_URL');
|
||||
// New fields
|
||||
$helper->fields_value['GDPR_COOKIE_DATA_CONTROLLER'] = Configuration::get('GDPR_COOKIE_DATA_CONTROLLER');
|
||||
$helper->fields_value['GDPR_COOKIE_RETENTION_PERIOD'] = Configuration::get('GDPR_COOKIE_RETENTION_PERIOD');
|
||||
$helper->fields_value['GDPR_COOKIE_THIRD_PARTIES'] = Configuration::get('GDPR_COOKIE_THIRD_PARTIES');
|
||||
$helper->fields_value['GDPR_COOKIE_MANAGE_TEXT'] = Configuration::get('GDPR_COOKIE_MANAGE_TEXT');
|
||||
$helper->fields_value['GDPR_COOKIE_ONLY_REQUIRED'] = Configuration::get('GDPR_COOKIE_ONLY_REQUIRED');
|
||||
|
||||
return $helper->generateForm([$form]);
|
||||
}
|
||||
@ -276,11 +306,11 @@ class GdprCookieConsent extends Module
|
||||
'gdprCookieMoreInfoUrl' => $this->context->link->getCMSLink(
|
||||
Configuration::get('GDPR_COOKIE_MORE_INFO_URL')
|
||||
),
|
||||
// New variables
|
||||
'gdprCookieDataController' => Configuration::get('GDPR_COOKIE_DATA_CONTROLLER', ''),
|
||||
'gdprCookieRetentionPeriod' => Configuration::get('GDPR_COOKIE_RETENTION_PERIOD', '365 days'),
|
||||
'gdprCookieThirdParties' => Configuration::get('GDPR_COOKIE_THIRD_PARTIES', ''),
|
||||
'gdprCookieManageText' => Configuration::get('GDPR_COOKIE_MANAGE_TEXT', 'Manage Cookies'),
|
||||
'gdprCookieOnlyRequired' => Configuration::get('GDPR_COOKIE_ONLY_REQUIRED'),
|
||||
]);
|
||||
|
||||
// Assign variables to Smarty for the manage button template
|
||||
@ -317,6 +347,7 @@ class GdprCookieConsent extends Module
|
||||
'gdprCookieRetentionPeriod' => Configuration::get('GDPR_COOKIE_RETENTION_PERIOD'),
|
||||
'gdprCookieThirdParties' => Configuration::get('GDPR_COOKIE_THIRD_PARTIES'),
|
||||
'gdprCookieManageText' => Configuration::get('GDPR_COOKIE_MANAGE_TEXT'),
|
||||
'gdprCookieOnlyRequired' => Configuration::get('GDPR_COOKIE_ONLY_REQUIRED'),
|
||||
]);
|
||||
|
||||
return $this->display(__FILE__, 'views/templates/hook/footer.tpl');
|
||||
|
Reference in New Issue
Block a user