Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-8650 Pre cleaning #1093

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions hdbt.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ embedded-content-cookie-compliance:
- core/jquery
- core/drupal
- core/drupalSettings
- eu_cookie_compliance/eu_cookie_compliance

global-styling:
version: 1.x
Expand Down Expand Up @@ -107,7 +106,6 @@ matomo:
dependencies:
- core/drupal
- core/jquery
- eu_cookie_compliance/eu_cookie_compliance

closable_announcements:
version: 1.1
Expand Down
26 changes: 26 additions & 0 deletions hdbt.theme
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,32 @@ function hdbt_preprocess_paragraph__news_archive(&$variables) {
}
}

/**
* Implements hook_library_info_alter().
*/
function hdbt_library_info_alter(array &$libraries, string $extension): void {
// Add the "eu_cookie_compliance/eu_cookie_compliance" library as a
// dependency for the matomo and embedded content libraries if the
// EU Cookie compliance module is enabled.
if (
$extension !== 'hdbt' ||
!\Drupal::moduleHandler()->moduleExists('eu_cookie_compliance')
) {
return;
}

$dependent_libraries = [
'matomo',
'embedded-content-cookie-compliance',
];

foreach ($dependent_libraries as $dependent_library) {
if (isset($libraries[$dependent_library])) {
$libraries[$dependent_library]['dependencies'][] = 'eu_cookie_compliance/eu_cookie_compliance';
}
}
}

/**
* Set site information as variables for templates.
*
Expand Down