mcatze
Well-known member
Hi, its me.. again.
I've try to build a little addon for default cover images in article threads. In every node option when article thread is set, you can upload a default image. It is stored per data assets and the url is set in db table xf_node.
My problem now is the way how to get this image in the thread template per node_id. I tried to extend the XF/Repository/Thread.php and find the imagePath per
Can someone give me a hint how to solve this problem?
I've try to build a little addon for default cover images in article threads. In every node option when article thread is set, you can upload a default image. It is stored per data assets and the url is set in db table xf_node.
My problem now is the way how to get this image in the thread template per node_id. I tried to extend the XF/Repository/Thread.php and find the imagePath per
XF:Thread
where node_id == $nodeId
. But i am stucked.
PHP:
<?php
namespace XT\CoverArticleThread\XF\Repository;
use XF\Mvc\Entity\Finder;
use XF\Mvc\Entity\Repository;
class Thread extends XFCP_Thread
{
public function findThreadsByNodeId($nodeId)
{
/** @var \XF\Finder\Thread $finder */
$finder = $this->finder('XF:Thread');
$finder
->with('Node')
->where('node_id', '=', $node_id);
return $finder;
}
}
Can someone give me a hint how to solve this problem?