XF 2.0 Getting the corresponding $resource connected to a specific $thread

entelechy

Active member
When you create a resource through resource manager, a resource and a thread are both created, and can be accessed by the "overview" and "discussion" tabs.

{{ link('resources', $resource) }} is used on the "overview" tab, but how can I get the $resource on the /forums/ page one level up from the resource itself by using the $thread that corresponds to it.

I'm trying to edit the button that selects a resource to load the overview by default instead of the discussion, and am modifying this link within the thread_list_macros template:

<a href="{{ link('threads' . (($thread.isUnread() AND !$forceRead) ? '/unread' : ''), $thread) }}" class="" data-tp-primary="on" data-xf-init="{{ $canPreview ? 'preview-tooltip' : '' }}" data-preview-url="{{ $canPreview ? link('threads/preview', $thread) : '' }}">{$thread.title}</a>
 
Ok no probs Mike, if anyone has any further knowledge and suggestions regarding exposing $resource in order to be able to make the default starting page when clicking on a resource the overview (/resources/) instead of the discussion (/forums/) tabs/pages, would be great.
 
findResourceForThread() method in XFRM\Repository\ResourceItem.php takes a $thread as an argument and looks like it could be used to find the $resource connected to a discussion. Is anyone able to confirm this?
 
Back
Top Bottom