Skip to content

Commit

Permalink
terminate early
Browse files Browse the repository at this point in the history
  • Loading branch information
mjauvin committed Oct 6, 2024
1 parent 37d76a8 commit 7030adc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions classes/MLPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ class MLPage
public static function resolveMenuItem(object $item, string $url, Theme $theme): ?array
{
$result = CmsPage::resolveMenuItem($item, $url, $theme);
$locales = Locale::listEnabled();

if ($result && ($page = CmsPage::loadCached($theme, $item->reference))) {

$locales = Locale::listEnabled();
if (count($locales) > 1 && $result && ($page = CmsPage::loadCached($theme, $item->reference))) {
$defaultLocale = Locale::getDefault();

$alternateLinks = [];
Expand All @@ -31,7 +30,7 @@ public static function resolveMenuItem(object $item, string $url, Theme $theme):
$alternateLinks[$locale] = Url::to($pageUrl);
}

if (count($alternateLinks) > 1) {
if ($alternateLinks) {
$result['alternateLinks'] = $alternateLinks;
}
}
Expand Down

0 comments on commit 7030adc

Please sign in to comment.