Skip to content

Commit

Permalink
Merge ec1cf2e into 03c2099
Browse files Browse the repository at this point in the history
  • Loading branch information
boehsermoe committed Nov 20, 2018
2 parents 03c2099 + ec1cf2e commit 7ed7558
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions core/web/UrlManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,16 +358,20 @@ private function urlReplaceModule($url, $navItemId, Composition $composition)
throw new BadRequestHttpException("Unable to find nav_item_id '$navItemId' to generate the module link for url '$url'.");
}

$isOutgoingModulePage = $item->type == 2 && $moduleName !== $item->moduleName;

// 1. if the current page is a module and the requested url is not the same module, its an outgoing link to
// another module which should not be modificated.
// 2. If the current page (nav) context is the homepage, we have to keep the original link as it wont work because the homepage
// does not have a route prefix.
if (($item->type == 2 && $moduleName !== $item->moduleName) || $item->isHome) {
if ($isOutgoingModulePage || $item->isHome) {
return $url;
}

// if current controller context has an other module as the requested url, its an outgoing link to another module which should not be modificated.
if ($moduleName !== Yii::$app->controller->module->id) {

// 1. if the current page is a module and the requested url is not the same module, its an outgoing link to
// another module and ...
// 2. if current controller context has an other module as the requested url, its an outgoing link to another module which should not be modificated.
if ($isOutgoingModulePage && $moduleName !== Yii::$app->controller->module->id) {
return $url;
}

Expand Down

0 comments on commit 7ed7558

Please sign in to comment.