My add-on retrieves the content of the first post and in the template I use {xen:helper snippet, $post.message, $xenOptions.ctaFtMaxContentLength} to trim to a max number of characters.
Using the helper also conveniently removes bbcode tags.
However, XenForo\Helper\String.php line 409 is:
Which avoids the problem of having empty previews in the event that there are just attachments, media and images; they are replaced with [ATTACH], [media] and [IMG] respectively.
However I want to remove those placeholder tags using:
Using that in the controller doesn't work as doing a Zend_Debug::dump($message); shows that the content is actually the original post content, with all bbcode, when it is passed to the template.
So where and how do I run the preg_replace to strip out those placeholder tags?
Using the helper also conveniently removes bbcode tags.
However, XenForo\Helper\String.php line 409 is:
PHP:
$string = preg_replace('#\[(attach|media|img)[^\]]*\].*\[/\\1\]#siU', '[\\1]', $string);
However I want to remove those placeholder tags using:
PHP:
$message = preg_replace('/\[(attach|media|img)\]/siU', '', $post['message']);
Using that in the controller doesn't work as doing a Zend_Debug::dump($message); shows that the content is actually the original post content, with all bbcode, when it is passed to the template.
So where and how do I run the preg_replace to strip out those placeholder tags?