From 50ead13dad8f7291c5e2bdb76c5c9d5df399fc26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szab=C3=B3=20Gerg=C5=91?= Date: Thu, 14 Jul 2022 21:44:17 +0200 Subject: [PATCH] Improved the Tag list component --- components/Tags.php | 17 ++++++++++------- components/tags/default.htm | 6 ++---- lang/en/lang.php | 8 ++++---- lang/hu/lang.php | 8 ++++---- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/components/Tags.php b/components/Tags.php index 2dcb3e0..428c578 100644 --- a/components/Tags.php +++ b/components/Tags.php @@ -32,8 +32,8 @@ public function defineProperties() 'showExternalParam' => false ], 'tagPage' => [ - 'title' => 'indikator.news::lang.settings.tag_page_title', - 'description' => 'indikator.news::lang.settings.tag_page_description', + 'title' => 'indikator.news::lang.settings.tags_page_title', + 'description' => 'indikator.news::lang.settings.tags_page_description', 'type' => 'dropdown', 'default' => '' ] @@ -51,11 +51,14 @@ public function onRun() $news = Posts::where('status', 1)->where('published_at', '<=', date('Y-m-d H:i:00'))->get()->all(); foreach ($news as $post) { - foreach ($post['tags'] as $tag) { - if (! in_array($tag, $tags)) { - $tags[] = $tag; - } - } + if ($post['tags'] !== null) { + $post['tags'] = explode(',', $post['tags']); + foreach ($post['tags'] as $tag) { + if (! in_array($tag, $tags)) { + $tags[] = $tag; + } + } + } } usort($tags, function($item1, $item2) { diff --git a/components/tags/default.htm b/components/tags/default.htm index d3ed8d9..e028c94 100644 --- a/components/tags/default.htm +++ b/components/tags/default.htm @@ -1,10 +1,8 @@ -{% set tags = __SELF__.tags %} - {% for tag in tags %} {% if loop.first %} -