Jaxel
Well-known member
I'm getting this error with a bbcode code. The bbcode worked in XF1.2... but has since stopped working on XF1.3. The odd thing is, I have other bbcode with my other mods that look very similar, but they all work perfectly fine. Whats wrong with this one?
And to reiterate, this code, which uses the same exact call to createTemplateObject, is working perfectly fine:
Code:
<?php
class EWRrio_BbCode_Formatter extends XFCP_EWRrio_BbCode_Formatter
{
protected $_tags;
public function getTags()
{
$this->_tags = parent::getTags();
$this->_tags['stream'] = array(
'trimLeadingLinesAfter' => 1,
'callback' => array($this, 'renderTagStream'),
);
return $this->_tags;
}
public function renderTagStream(array $tag, array $rendererStates)
{
$content = $this->renderSubTree($tag['children'], $rendererStates);
if ($tag['option'] && $content)
{
if ($service = XenForo_Model::create('EWRrio_Model_Services')->getServiceByBBcode($tag['option']))
{
$values = explode(',', $content);
$service['channel_value1'] = $values[0];
$service['channel_value2'] = !empty($values[1]) ? $values[1] : '';
$channel = XenForo_Model::create('EWRrio_Model_Channels')->parseReplacements($service);
$channel['channel_chat'] = '';
}
}
else if ($content)
{
$channel = XenForo_Model::create('EWRrio_Model_Channels')->getChannelByID($content);
}
if (!empty($channel))
{
if ($this->_view)
{
$template = $this->_view->createTemplateObject('EWRrio_BBcode', array('channel' => $channel));
return $template->render();
}
return '<a href="'.XenForo_Link::buildPublicLink('streams/stream', $channel).'">' . $channel['channel_value1'] . '</a>';
}
return '[stream' . ($tag['option'] ? '='. $tag['option'] : '') . ']'.$content.'[/stream]';
}
}
And to reiterate, this code, which uses the same exact call to createTemplateObject, is working perfectly fine:
Code:
<?php
class EWRcustom_BbCode_Formatter extends XFCP_EWRcustom_BbCode_Formatter
{
protected $_tags;
public function getTags()
{
$this->_tags = parent::getTags();
$this->_tags['spoiler'] = array(
'trimLeadingLinesAfter' => 2,
'callback' => array($this, 'renderTagSpoiler')
);
return $this->_tags;
}
public function renderTagSpoiler(array $tag, array $rendererStates)
{
$content = $this->renderSubTree($tag['children'], $rendererStates);
$spoiler = $tag['option'];
if ($this->_view)
{
$template = $this->_view->createTemplateObject('EWRcustom_spoiler', array(
'content' => $content,
'spoiler' => $spoiler
));
return $template->render();
}
else
{
$name = '<div>' . new XenForo_Phrase('spoiler_warning') . ($spoiler ? ': '.$spoiler : '') . '</div>';
return '<blockquote>' . $name . $content . '</blockquote>';
}
}
}