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: Preparation for the HDS cookie banner module #948

Closed
wants to merge 1 commit into from
Closed
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
17 changes: 14 additions & 3 deletions public/themes/custom/hdbt_subtheme/hdbt_subtheme.theme
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,22 @@
* Implements hook_preprocess_HOOK().
*/
function hdbt_subtheme_preprocess_paragraph__journey_planner(array &$variables): void {
// Attach the embedded content cookie compliance library.
$variables['#attached']['library'][] = 'hdbt/embedded-content-cookie-compliance';

$langcode = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId();
$variables['privacy_policy_url'] = helfi_eu_cookie_compliance_get_privacy_policy_url();
// Set the necessary variables for the journey planner.
$variables['media_service_url'] = 'https://reittiopas.hsl.fi';
$variables['media_url'] = 'https://reittiopas.hsl.fi/haku?bikeOnly=1&lang=' . $langcode;
$variables['media_url'] = 'https://reittiopas.hsl.fi/haku?bikeOnly=1&lang=' . $variables['language']->getId();
$variables['media_id'] = 'journey-map';

// Set the privacy policy URL.
if (Drupal::moduleHandler()->moduleExists('hdbt_cookie_banner')) {
/** @var \Drupal\hdbt_cookie_banner\Services\CookieSettings $cookie_settings */
$cookie_settings = \Drupal::service('hdbt_cookie_banner.cookie_settings');

Check failure on line 112 in public/themes/custom/hdbt_subtheme/hdbt_subtheme.theme

View workflow job for this annotation

GitHub Actions / tests

PHPDoc tag @var for variable $cookie_settings contains unknown class Drupal\hdbt_cookie_banner\Services\CookieSettings.
$variables['privacy_policy_url'] = $cookie_settings->getCookieSettingsPageUrl();

Check failure on line 113 in public/themes/custom/hdbt_subtheme/hdbt_subtheme.theme

View workflow job for this annotation

GitHub Actions / tests

Call to method getCookieSettingsPageUrl() on an unknown class Drupal\hdbt_cookie_banner\Services\CookieSettings.
}
// @todo UHF-10862 Remove once the HDBT cookie banner module is in use.
elseif (Drupal::moduleHandler()->moduleExists('helfi_eu_cookie_compliance')) {
$variables['privacy_policy_url'] = helfi_eu_cookie_compliance_get_privacy_policy_url();
}
}
Loading