forked from umakantp/jsmart
-
Notifications
You must be signed in to change notification settings - Fork 2
addDefaultModifier
pfaciana edited this page Sep 25, 2019
·
2 revisions
Add a modifier to implicitly apply to every variable in a template unless a variable has the nofilter flag.
modifiers is a string or array of strings
Latte.prototype.addDefaultModifier('escape'); //global modifier for every instance of Latte
var t = new Latte(...);
t.addDefaultModifier(["regex_replace:'/bar/':'buh'", 'upper']);
//modifiers for this instance only (applied AFTER global modifiers)
t.fetch(...);
in template :
{$foo = '<b>bar</b>'}
{$foo}
{$foo nofilter}
output :
<B>BUH</B>
<b>bar</b>
see also registerFilter