function eu_cookie_compliance_module_set_weight in EU Cookie Compliance (GDPR Compliance) 7.2
Same name and namespace in other branches
- 8 eu_cookie_compliance.module \eu_cookie_compliance_module_set_weight()
- 7 eu_cookie_compliance.install \eu_cookie_compliance_module_set_weight()
2 calls to eu_cookie_compliance_module_set_weight()
- eu_cookie_compliance_install in ./
eu_cookie_compliance.install - Implements hook_install().
- eu_cookie_compliance_update_7007 in ./
eu_cookie_compliance.install - Version 1.24. Be sure weight of the module is higher than jQuery Update.
File
- ./
eu_cookie_compliance.install, line 120 - Installation file.
Code
function eu_cookie_compliance_module_set_weight() {
if (module_exists('jquery_update')) {
// @TODO: Document why this weight change is needed. Add a test.
// Get the weight of the jquery update module.
$result = db_select('system', 's')
->fields('s', array(
'weight',
))
->condition('name', 'jquery_update', '=')
->execute();
$weight = !empty($result) ? $result
->fetchField() : 0;
// Set the weight of this module to 1 heavier.
db_update('system')
->fields(array(
'weight' => $weight + 1,
))
->condition('name', 'eu_cookie_compliance', '=')
->execute();
}
}