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-8678 Automatic install for HDS cookie banner #844

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Changes from 1 commit
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
Next Next commit
UHF-8678: Install the HDBT cookie banner module to core-instances.
khalima committed Nov 12, 2024
commit fed7a191bfab332777ed2398b61c922469967838
38 changes: 38 additions & 0 deletions helfi_platform_config.install
Original file line number Diff line number Diff line change
@@ -202,3 +202,41 @@ function helfi_platform_config_update_9313() : void {
$module_installer->install(['helfi_paragraphs_curated_event_list']);
}
}
/**
* UHF-8650: Install HDBT Cookie banner module.
*
* This update will also uninstall EU Cookie compliance and
* Helfi EU Cookie compliance modules.
*/
function helfi_platform_config_update_9314(): void {
/** @var \Drupal\helfi_api_base\Environment\EnvironmentResolver $environmentResolver */
$environmentResolver = \Drupal::getContainer()->get('helfi_api_base.environment_resolver');

// Handle only Helfi core sites.
try {
$environmentResolver->getActiveEnvironment();
}
catch (\InvalidArgumentException) {
return;
}

$module_handler = \Drupal::moduleHandler();
$module_installer = \Drupal::service('module_installer');

// Install the HDBT cookie banner module.
if (!$module_handler->moduleExists('hdbt_cookie_banner')) {
$module_installer->install(['hdbt_cookie_banner']);
}

// Uninstall the EU Cookie compliance and Helfi EU Cookie compliance
// modules if they are installed.
if (
$module_handler->moduleExists('eu_cookie_compliance') ||
$module_handler->moduleExists('helfi_eu_cookie_compliance')
) {
$module_installer->uninstall([
'eu_cookie_compliance',
'helfi_eu_cookie_compliance',
]);
}
}