getgrav / grav-premium-issues

Official Grav Premium Issues repository to report problems or ask questions regarding the Premium products offered.
https://getgrav.org/premium
7 stars 2 forks source link

[typhoon] [bug] Fix two URLs for additional language #306

Closed Sogl closed 1 year ago

Sogl commented 2 years ago

Related issue: https://github.com/getgrav/grav-plugin-langswitcher/issues/65

I found what was the problem and found a solution. Just because login and langswitcher menus dynamically creates from themes/typhoon/typhoon.php in onSiteThemeMenu($event) function, we need to change these lines:

155 | $base_lang_url = Utils::url($language->getLanguageUrlPrefix($lang));
156 | $lang_url = $base_lang_url . $langswitcher->page_route . $page->urlExtension();

on those:

if ($langswitcher->translated_routes[$lang]) {
    $lang_url = $langswitcher->translated_routes[$lang] . $page->urlExtension();
} else {
    $base_lang_url = Utils::url($language->getLanguageUrlPrefix($lang));
    $lang_url = $base_lang_url . $langswitcher->page_route . $page->urlExtension();
}

according to new changes in langswitcher: https://github.com/getgrav/grav-plugin-langswitcher/blob/master/templates/partials/langswitcher.html.twig#L10

Need to somehow keep such parts of the code in sync with plugins changes 😄

rhukster commented 2 years ago

Makes total sense now, i forgot to update those as part of the langswitcher revamp.

rhukster commented 1 year ago

Fixed in next release.