From bf022665d06668572f7255feab0797a445290da1 Mon Sep 17 00:00:00 2001 From: Bliwi <98432414+Bliwi@users.noreply.github.com> Date: Tue, 4 Feb 2025 16:42:48 -0300 Subject: [PATCH] Create a group for ungrouped tags Creates a group for ungrouped tags after it finishes ordering all the grouped tags tags on group view. --- main.inc.php | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/main.inc.php b/main.inc.php index 835bac9..6b400d8 100644 --- a/main.inc.php +++ b/main.inc.php @@ -88,10 +88,10 @@ function tg_groups_display() foreach ($tags as $tag) { - // if the tag belongs to no group, we don't show it on the "tag by // group" display mode if (strpos($tag['name'], ':') === false) { + $tags_without_groups[] = $tag; continue; } else @@ -158,6 +158,37 @@ function tg_groups_display() $tag_group ); } + // Create a group for tags without groups + if (count($tags_without_groups) > 0) + { + $tag_group = array( + 'TITLE' => l10n('Ungrouped tags'), + 'tags' => array() + ); + + foreach ($tags_without_groups as $tag) + { + $tag_group['ID'] = $tag['id']; + array_push( + $tag_group['tags'], + array_merge( + $tag, + array( + 'URL' => make_index_url( + array( + 'tags' => array($tag), + ) + ), + ) + ) + ); + } + + $template->append( + 'tag_groups', + $tag_group + ); + } } }