Conditional Text Filtering
In the code sample above where a text filter is registered with Movable Type, a condition is defined under which text filtering is allowed. The call back determines whether or not the text filter can be selected by a user via the web interface. The callback is called with a single parameter, the type of the object being transformed. Allowable values for the object type are:
- "entry"
- "comment"
The callback should return "1" if filtering is allowed, and "0" otherwise.
# Will only allow the text filter to be applied to comments
sub transform_when {
my ($obj_type) = @_;
return 1 if $obj_type && ($obj_type eq 'comment');
}
- Previous: Text Filter Handler
- Next: Custom OpenID Login Screens

Leave a note
Have a question, please use the MT Forums. Notes sumbitted here should pertain to tips & hints regarding documentation. Your note may be removed once it's contents has be integrated into the body of the page.