[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX][ENH] Backlinks: show an icon for every backlink type, not just wiki pages and tracker items
"luci \(@luciash\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a91a8dd3b467_3818e228401c1@gitlab-sidekiq-low-urgency-cpu-bound-v2-665d95559f-dkwqt.mail> |
luci pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
5f5c68d7 by UshindiG at 2026-08-28T15:12:07+00:00
[FIX][ENH] Backlinks: show an icon for every backlink type, not just wiki pages and tracker items
---
* [FIX] Backlinks: show an icon for every backlink type, not just wiki pages and tracker items
See merge request tikiwiki/tiki!11057
- - - - -
2 changed files:
- lib/wiki/wikilib.php
- templates/tiki-wiki_topline.tpl
Changes:
=====================================
lib/wiki/wikilib.php
=====================================
@@ -1435,6 +1435,16 @@ class WikiLib extends TikiLib
$result = $this->query($query, [$page]);
$ret = [];
+ $backlinkIcons = [
+ 'wiki page' => 'notepad',
+ 'trackeritemfield' => 'database',
+ 'article' => 'articles',
+ 'post' => 'blog',
+ 'forum post' => 'comments',
+ 'calendar event' => 'calendar',
+ ];
+ $seenTrackerItems = [];
+
while ($res = $result->fetchRow()) {
$is_wiki_page = substr($res['fromPage'], 0, 11) != 'objectlink:';
if ($is_wiki_page) {
@@ -1461,6 +1471,10 @@ class WikiLib extends TikiLib
if (! $itemObject->canView() || ! $itemObject->canViewField($fieldId)) {
continue;
}
+ if (isset($seenTrackerItems[$itemId])) {
+ continue;
+ }
+ $seenTrackerItems[$itemId] = true;
} else {
$objectperms = Perms::get(['type' => $type, 'object' => $objectId]);
if (! $objectperms->view) {
@@ -1469,6 +1483,7 @@ class WikiLib extends TikiLib
}
$aux["type"] = $type;
$aux["objectId"] = $objectId;
+ $aux["icon"] = $backlinkIcons[$type] ?? (str_ends_with($type, 'comment') ? 'comment' : 'link');
$ret[] = $aux;
}
=====================================
templates/tiki-wiki_topline.tpl
=====================================
@@ -79,11 +79,7 @@
{capture name=backlink_title}{object_title id=$backlinks[back].objectId type=$backlinks[back].type}{/capture}
{*<li role="presentation">*}
<span class="dropdown-item" role="menuitem" tabindex="-1">
- {if $backlinks[back].type eq 'wiki page'}
- <span class="me-1">{icon name="notepad"}</span>
- {elseif $backlinks[back].type eq 'trackeritemfield'}
- <span class="me-1">{icon name="database"}</span>
- {/if}
+ <span class="me-1">{icon name=$backlinks[back].icon}</span>
{if $prefs.wiki_backlinks_name_len ge '1'}
{object_link id=$backlinks[back].objectId type=$backlinks[back].type title=$smarty.capture.backlink_title|truncate:$prefs.wiki_backlinks_name_len:"...":true}
{else}
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5f5c68d7e5916842157adeb89336f97cc3d2d134
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/5f5c68d7e5916842157adeb89336f97cc3d2d134
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs