Is it possible to add an IF statement to a custom bbcode callback so the code return would depend on what the user has entered in the bbcode options?
A basic example of what I'm using below. A bbcode with 2 options...
So could I add an IF statement in there somewhere to say something like... IF ($option1 = 2) then return "THIS".
I've tried adding one in a few places but none seem to work.
A basic example of what I'm using below. A bbcode with 2 options...
PHP:
class BbcodeParser {
public static function test($tagChildren, $tagOption, $tag, array $options, \XF\BbCode\Renderer\AbstractRenderer $renderer)
{
$res = $renderer->renderSubTree($tagChildren, $options);
$toptions = trim(strip_tags($tag['option']));
$toptions = preg_split("|,|", $toptions, -1, PREG_SPLIT_NO_EMPTY);
@list($option1, $option2) = $toptions;
if ($tmp = trim($option1)) {
$one = "$tmp";
}
if ($tmp = trim($option2)) {
$two = "$tmp";
}
return "{$one} {$two}";
}
}
So could I add an IF statement in there somewhere to say something like... IF ($option1 = 2) then return "THIS".
I've tried adding one in a few places but none seem to work.