jrCore_format_string formats text that members write, such as a blog post or a biography. It runs every text formatter the member's quota allows, so a template doesn't need to know which ones the site has:
{$item.blog_text|jrCore_format_string:$item.profile_quota_id}
{$profile_bio|jrCore_format_string:$profile_quota_id}Always pass the quota ID of the profile the text belongs to. Formatters are turned on per quota.
The options are given after the modifier, separated by colons.
Admins choose the formatters for each quota in ACP > Modules > Core > System Core > Quota Config > Active Text Formatters. A fresh Jamroom has:
| Name | Label | What it does |
|---|---|---|
html |
Allow HTML | Keeps the HTML tags allowed in the quota's Allowed HTML Tags |
bbcode |
Allow BBCode | Turns BBCode, such as [b], into HTML |
at_tags |
Convert @ Tags | Links @profile_name to the profile |
click_urls |
Make URLs Clickable | Turns web addresses into links |
hash_tags |
(Timeline) | Links #hashtags |
embed |
(Editor Embedded Media) | Turns [jrEmbed] tags into media |
Other modules add more. See What is a Text Formatter?.
Only run some formatters with a whitelist, or skip some with a blacklist:
{$item.comment_text|jrCore_format_string:$item.profile_quota_id:"bbcode,click_urls"}
{$item.comment_text|jrCore_format_string:$item.profile_quota_id:false:"bbcode"}Register the formatter in your module's _init() function:
$_tmp = array(
'wl' => 'click_urls',
'label' => 'Make URLs Clickable',
'help' => 'If active, URLs entered into the text will be hyperlinked so they are clickable.'
);
jrCore_register_module_feature('jrCore', 'format_string', 'jrCore', 'jrCore_format_string_clickable_urls', $_tmp);wl: the name used in whitelists and blacklistslabel and help: shown in Active Text Formattersfunction jrCore_format_string_clickable_urls($string, $quota_id = 0)
{
return jrCore_string_to_url($string);
}A formatter can't take options from the template. If it needs one, such as a size, make it a Global Config setting of your module.