Yodrak
in memoriam 1976 - 2020
Hello, i have problems to pass 2 Variables wich i have created in my Addon to the template poll_macros.
The path is similar to /XF/Pub/Controller.php and this is my code.
If i dump the Poll Edit Template my variables are not visible.
The path is similar to /XF/Pub/Controller.php and this is my code.
PHP:
<?php
namespace Yodrak\PhotoPoll\XF\Pub\Controller;
use XF\Mvc\ParameterBag;
class Thread extends XFCP_Thread
{
public function actionIndex(ParameterBag $params)
{
$parent = parent::actionIndex($params);
if (!$parent instanceof \XF\Mvc\Reply\View)
{
return $parent;
}
$visitor = \XF::visitor();
if (!$visitor->hasPermission('photoPoll', 'view'))
{
return $parent;
}
$options = \XF::options();
$includeForums = $options->photoContestIncludeForums;
$thread = $this->assertViewableThread($params->thread_id);
$threadId = $thread['thread_id'];
$nodeId = $thread->node_id;
if (!in_array($nodeId, $includeForums))
{
return $parent;
}
$finder = \XF::finder('XF:Post');
$photoPollPosts = $finder
->where('thread_id', $threadId)
->where('message_state', '=', 'visible')
->order('username')
->fetch();
$postRepo = $this->getPostRepo();
$postList = $postRepo->findPostsForThreadView($thread)->onPost(2, 200);
$photoPollThumbnails = $postList->fetch();
$parent->setParams([
'photoPollPosts' => $photoPollPosts,
'photoPollThumbnails' => $photoPollThumbnails
]);
return $this->view('XF:Poll\Create', 'poll_create', $parent);
}
}
If i dump the Poll Edit Template my variables are not visible.
Last edited: