Skip to content

Commit

Permalink
Correctly use ID if alias is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Jan 19, 2021
1 parent a0e323c commit 31a92e0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function onChangelanguageNavigation(ChangelanguageNavigationEvent $event)
$navigationItem = $event->getNavigationItem();

if ($navigationItem->isCurrentPage()) {
$event->getUrlParameterBag()->setUrlAttribute($this->getUrlKey(), $current->alias);
$event->getUrlParameterBag()->setUrlAttribute($this->getUrlKey(), $current->alias ?: $current->id);

return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function onChangelanguageNavigation(ChangelanguageNavigationEvent $event)
if (null === $targetArticle) {
$parameterBag->removeUrlAttribute('articles');
} else {
$parameterBag->setUrlAttribute('articles', $targetArticle->alias);
$parameterBag->setUrlAttribute('articles', $targetArticle->alias ?: $targetArticle->id);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ public function generateParameters()
return null;
}

if (isset($this->attributes['auto_item'])) {
if (isset($attributes['auto_item'])) {
throw new \RuntimeException('Do not set auto_item parameter');
}

if ($GLOBALS['TL_CONFIG']['useAutoItem']) {
$auto_item = array_intersect_key($this->attributes, array_flip((array) $GLOBALS['TL_AUTO_ITEM']));
$auto_item = array_intersect_key($attributes, array_flip((array) $GLOBALS['TL_AUTO_ITEM']));

switch (\count($auto_item)) {
case 0:
Expand Down

0 comments on commit 31a92e0

Please sign in to comment.