With an add-on it is actually quite simple to parse poll options with BB Code.
First you extend XenForo_ViewPublic_Thread_View:
And then similarly extend XenForo_ViewPublic_Thread_PollResults
After making a small template edit in poll_block_result and poll_block_vote (changing {$response.response} to {xen:raw $response.response}) the end result is as follows:
I would like to suggest this be considered for the core. As well as allowing us to add more context to polls and poll responses, it is also a feature that is missed when moving from other forum software.
Also worth considering is the VARCHAR length of the xf_poll_response.response field. The length is 100 and although in the context of plain text that is a reasonable length, with BB Code this should probably get larger (preferably to match the same limits provided by PHPBB and vBulletin to aid in imports).
First you extend XenForo_ViewPublic_Thread_View:
PHP:
public function renderHtml()
{
$parent = parent::renderHtml();
if (!empty($this->_params['poll']))
{
$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
foreach ($this->_params['poll']['responses'] AS &$response)
{
$response['response'] = new XenForo_BbCode_TextWrapper($response['response'], $bbCodeParser);
}
}
return $parent;
}
And then similarly extend XenForo_ViewPublic_Thread_PollResults
After making a small template edit in poll_block_result and poll_block_vote (changing {$response.response} to {xen:raw $response.response}) the end result is as follows:
I would like to suggest this be considered for the core. As well as allowing us to add more context to polls and poll responses, it is also a feature that is missed when moving from other forum software.
Also worth considering is the VARCHAR length of the xf_poll_response.response field. The length is 100 and although in the context of plain text that is a reasonable length, with BB Code this should probably get larger (preferably to match the same limits provided by PHPBB and vBulletin to aid in imports).
Upvote
14