function eu_cookie_compliance_js_alter in EU Cookie Compliance (GDPR Compliance) 8
Same name and namespace in other branches
- 7.2 eu_cookie_compliance.module \eu_cookie_compliance_js_alter()
- 7 eu_cookie_compliance.module \eu_cookie_compliance_js_alter()
Implements hook_js_alter().
File
- ./
eu_cookie_compliance.module, line 769 - The main file for the EU Cookie Compliance module.
Code
function eu_cookie_compliance_js_alter(&$javascript, AttachedAssetsInterface $assets) {
$config = \Drupal::config('eu_cookie_compliance.settings');
$disabled_javascripts = $config
->get('disabled_javascripts');
$disabled_javascripts = _eu_cookie_compliance_explode_multiple_lines($disabled_javascripts);
foreach ($disabled_javascripts as $script) {
// Remove 'category:' if present.
$parts = explode('%3A', $script);
if (count($parts) > 2) {
array_shift($parts);
$script = implode(':', $parts);
}
else {
$script = end($parts);
}
// Parse the string and drop the parameter that is a behavior name.
if (strpos($script, '%7C') !== FALSE) {
@(list($script, $attach_name) = explode('%7C', $script));
}
_eu_cookie_compliance_convert_relative_uri($script);
unset($javascript[$script]);
}
}