Skip to content

Commit

Permalink
Do not show all articles in other columns
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Sep 2, 2021
1 parent 366c519 commit 0b4cef8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/EventListener/BackendView/ArticleViewListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,18 @@ protected function getAvailableLanguages(PageModel $page)
}
}

$articles = array_values(array_filter($articles, function (ArticleModel $article) {
return $article->inColumn === $this->currentArticle->inColumn;
}));

if (1 === \count($articles)) {
$options[$articles[0]->id] = $this->getLanguageLabel($model->language);
continue;
}

// Otherwise add all articles
foreach ($articles as $article) {
if ($article->inColumn === $this->currentArticle->inColumn) {
$options[$article->id] = $this->getLanguageLabel($model->language).': '.$article->title;
}
$options[$article->id] = $this->getLanguageLabel($model->language).': '.$article->title;
}
}

Expand Down

0 comments on commit 0b4cef8

Please sign in to comment.