From 67165b4cf7cf465d5f728a60d2a3b7eebcdd13b6 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 5 Apr 2020 18:57:59 +0200 Subject: [PATCH] make dashboard elements portlets --- Controller/BackendController.php | 4 +++- Theme/Backend/dashboard-news.tpl.php | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 5e16296..f07d268 100644 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -77,7 +77,9 @@ final class BackendController extends Controller implements DashboardElementInte $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/News/Theme/Backend/dashboard-news'); - $news = NewsArticleMapper::getNewest(5); + $news = NewsArticleMapper::withConditional('language', $response->getHeader()->getL11n()->getLanguage()) + ::getNewest(5); + $view->addData('news', $news); return $view; diff --git a/Theme/Backend/dashboard-news.tpl.php b/Theme/Backend/dashboard-news.tpl.php index 06b746c..e748236 100644 --- a/Theme/Backend/dashboard-news.tpl.php +++ b/Theme/Backend/dashboard-news.tpl.php @@ -16,12 +16,12 @@ declare(strict_types=1); * @var \phpOMS\Views\View $this */ -$newsList = $this->getData('news'); +$newsList = $this->getData('news') ?? []; ?>
-
+
+
getHtml('News', 'News'); ?>
-
getHtml('News', 'News'); ?>