MG 2.2 xfmg_media_list_macros: Generating link back to original thread?

arn

Well-known member
In the xfmg_media_list_macros, is it possible to get the link / title to the original thread in the template?

$mirrorContainer is available in xfmg_media_view, which provides this information - but I can't seem to access it in this template. There may be an obvious way, but I'm not clear on this.

arn
 
It's not directly exposed. You may be able to access it via templates, though I suspect this would trigger a number of queries as there's a bunch of data to load. Untested, but assuming the media item is in $mediaItem...

Code:
<xf:set var="$mirrorAttachment" value="{$mediaItem.MirrorAttachment}" />
<xf:set var="$mirrorContainer" value="{{ $mirrorAttachment ? $mirrorAttachment.Container : null }}" />
<xf:if is="$mirrorContainer AND $mirrorContainer.canView()">
Container link: {{ $mirrorAttachment.getContainerLink() }}
Container title: {{ $mirrorAttachment.getContainerTitle() }}
</xf:if>
 
It's not directly exposed. You may be able to access it via templates, though I suspect this would trigger a number of queries as there's a bunch of data to load. Untested, but assuming the media item is in $mediaItem...

Code:
<xf:set var="$mirrorAttachment" value="{$mediaItem.MirrorAttachment}" />
<xf:set var="$mirrorContainer" value="{{ $mirrorAttachment ? $mirrorAttachment.Container : null }}" />
<xf:if is="$mirrorContainer AND $mirrorContainer.canView()">
Container link: {{ $mirrorAttachment.getContainerLink() }}
Container title: {{ $mirrorAttachment.getContainerTitle() }}
</xf:if>

Thanks Mike. This works. I was able to generate link backs. It does trigger a ton more queries. 52 queries vs 7 for the normal media page. Page still loads at reasonable speed though.

One thing... The ContainerTitle comes back in this format

Post in thread 'Which Case Did You Get For Your New iPhone 12/Mini/Pro/Max? [Merged][2020]'

Is it trivial to just get the raw thread title instead?

arn
 
$mirrorContainer would be a reference to the actual post in this case, I believe, so you don't have to use getContainerTitle. Though equally bear in mind that the mirroring system is actually content agnostic. Our the current implementation only includes post attachments, but there isn't anything to say that this might not change in the future, so that's something to be aware of.
 
Top Bottom