XenForo_BbCode_Parser not parsing nested tags

CrispinP

Well-known member
#1
Folks,

I'm wresting with the bbcode parser.

I have the following in an add-on:
Custom bbcode, with php callback.
If calls:
Code:
public static function renderTagPreview (array $tag, array $rendererStates, XenForo_BbCode_Formatter_Base $formatter){

$view = $formatter->getView();
        if ($view)
        {
            $template = $view->createTemplateObject('my_cool_template', array(
                'attachmentid' => $data[1] //this is the attachmentid for this post.
            ));

            $ret = $template->render();
        }
 $ret .= "[ATTACH=full]". $data[1] . "[/ATTACH]"; //this is the attachementID
 $parser = new XenForo_BbCode_Parser( $formatter );
 return $parser->render($ret)
}
My template etc gets rendered ok, but the nested ATTACH does not. I simply get View Attachment

I'm pretty sure it has to do with permissions but none of the threads I've read seem to give me a clue as to where I am going wrong.

The closest I can see to solving my problem is this thread where Chris gives a hint but I miss it.

Anyone know of a nice snippet I can use or a nudge or two in the right direction?


Thanks
Crispin
 
Top