Skip to content

Commit

Permalink
#11 Fix: You must not have more than one "auto_item" paramter
Browse files Browse the repository at this point in the history
* We need to change load order to be loaded after the built in lang
switches
* Check if Auto Item is present, if yes: do nothing
* Update Documentation
  • Loading branch information
amenk committed Jun 27, 2021
1 parent 4daee4f commit ccd4f68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions contao/classes/ImiMMChangeLanguageObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ protected function getCurrentMetamodels() {
public function translateMMUrlsV3(
\Terminal42\ChangeLanguage\Event\ChangelanguageNavigationEvent $event
) {
if (count($event->getUrlParameterBag()->getUrlAttributes()) > 0) {
return;
}

// The target root page for current event
$targetRoot = $event->getNavigationItem()->getRootPage();
$targetLanguage = $targetRoot->language; // The target language
Expand Down Expand Up @@ -164,5 +168,6 @@ public function translateMMUrlsV3(

// fallback - if we do not have any translated values: use untranslated alias
$event->getUrlParameterBag()->setUrlAttribute('items', $alias);

}
}
1 change: 1 addition & 0 deletions contao/config/autoload.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
; List modules which are required to be loaded beforehand
;;
requires[] = "core"
requires[] = "changelanguage"

;;
; Configure what you want the autoload creator to register
Expand Down

0 comments on commit ccd4f68

Please sign in to comment.