diff --git a/src/EventListener/BackendView/ArticleViewListener.php b/src/EventListener/BackendView/ArticleViewListener.php index 6ee09b8..449f9e4 100644 --- a/src/EventListener/BackendView/ArticleViewListener.php +++ b/src/EventListener/BackendView/ArticleViewListener.php @@ -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; } }