function eu_cookie_compliance_update_8109 in EU Cookie Compliance (GDPR Compliance) 8
Add config variables for the withdraw banner.
File
- ./
eu_cookie_compliance.install, line 302 - Update scripts for the EU Cookie Compliance module.
Code
function eu_cookie_compliance_update_8109() {
$config = \Drupal::config('eu_cookie_compliance.settings');
$default_filter_format = filter_default_format();
$full_html_format = FilterFormat::load('full_html');
if (($default_filter_format === 'restricted_html' || $default_filter_format === 'plain_text') && !empty($full_html_format) && $full_html_format
->get('status')) {
$default_filter_format = 'full_html';
}
\Drupal::configFactory()
->getEditable('eu_cookie_compliance.settings')
->set('withdraw_message', [
'value' => $config
->get('withdraw_message')['value'] ?? '<h2>We use cookies on this site to enhance your user experience</h2><p>You have given your consent for us to set cookies.</p>',
'format' => $config
->get('withdraw_message')['format'] ?? $default_filter_format,
])
->set('withdraw_action_button_label', 'Withdraw consent')
->set('withdraw_tab_button_label', 'Privacy settings')
->set('withdraw_enabled', FALSE)
->set('popup_info_template', 'legacy')
->save();
}