XF 2.1 Trim [quote] bbcode from post preview

Scandal

Well-known member
This is from template thread_preview:
HTML:
    {{ bb_code($firstPost.message, 'post:thread_preview', $firstPost, {
        'lightbox': false
    }) }}
My question is: how could I trim the [ quote ] bbcode from it? I mean anything [ quote ] tag with its contents. :)

I could extend the Pub which doing this if needed (php code). This is:
PHP:
    public function actionPreview(ParameterBag $params)
    {
        $thread = $this->assertViewableThread($params->thread_id, ['FirstPost']);
        $firstPost = $thread->FirstPost;

        $viewParams = [
            'thread' => $thread,
            'firstPost' => $firstPost
        ];
        return $this->view('XF:Thread\Preview', 'thread_preview', $viewParams);
    }
 
I was able to make it by myself. For anyone who interested: you open template "thread_preview" and apply this content:
HTML:
<div class="tooltip-content-inner">
    {{ bb_code(snippet($firstPost.message, 1000, {'stripQuote': true, 'lightbox': false}), 'post:thread_preview', $firstPost, {'lightbox': false}) }}
    <span class="tooltip-content-cover"></span>
</div>
Of course this is a hard coded/ dev solution. You can apply it as automatic template modification if you want. ;)
 
Top Bottom