XF 1.3 Force case in custom BB Code option to be lower/upper?

Kevin

Well-known member
I'm working on adding a new custom BB Code. The new BB Code requires an option to be entered. Depending upon the option the CSS definition will be dynamic in the HTML replacement (eg: class="mybbcode{option}").

Getting that part working is pretty easy & straightforward. What I am running into though is that because on custom BB Codes the entry of the options are free form (as opposed to pre-defined entries from a drop-down) the user can enter the {option} in mixed case. If they enter "A" and I have a CSS class defined as "mybbcodeA" then everything works but if they enter "a" as the option then the CSS isn't found. The example is a bit simplified since it is only one letter in the example but really the options are several characters long so just creating both "mybbcodeA" & "mybbcodea" wouldn't work because with multiple character options I'd need a CCS class for every possible mixed case scenario.

Any thoughts on a quick & easy way of forcing the custom BB code option to be a specific case?
 
The only way you could transform the option, I believe, is by creating a PHP callback.

At some point in that code you'd be able to run the option through strtolower().

Otherwise, there's no way of doing it, unfortunately.
 
Back
Top Bottom