Ga naar inhoud

Template hooks

Deze inhoud is nog niet vertaald.

CampaignSuite Forms renders Blade templates in Gravity Forms text such as confirmations and notifications. Templates can only call a fixed list of safe functions, such as string, array and formatting helpers, and this hook extends that list.

Filter · includes/class-bladesandbox.php

Extends the functions Blade templates may call, on top of the built-in list. The default is an empty list. Names are matched case-insensitively and a leading backslash is ignored.

Warning: Only add functions that are free of side effects. A function you allow can be called by anyone who can edit a template, so do not add functions that write data, read files, options or the database, call the network, or run other code through callbacks.

Parameter Type Description
$functions string[] Extra function names. Default [].

Returns: string[] — the function names to allow.

add_filter('cs_forms_blade_allowed_functions', function ($functions) {
$functions[] = 'number_format';
$functions[] = 'mb_strtoupper';
return $functions;
});