Kernel::Output::TemplateToolkit::Plugin::OTRS

NAME

Kernel::Output::TemplateToolkit::Plugin::OTRS – Template Toolkit extension plugin

PUBLIC INTERFACE

new()

this plugin registers a few filters and functions in Template::Toolkit for use with Kernel::Output::TemplateToolkit.

These extensions have names starting with an uppercase letter so that you can distinguish them from the builtins of Template::Toolkit which are always lowercase.

Filters:

    [% Data.MyData  | Translate %]                         - Translate to user language.

    [% Data.Created | Localize("TimeLong") %]              - Format DateTime string according to user's locale.
    [% Data.Created | Localize("TimeShort") %]             - Format DateTime string according to user's locale, without seconds.
    [% Data.Created | Localize("Date") %]                  - Format DateTime string according to user's locale, only date.

    [% Data.Complex | Interpolate %]                       - Treat Data.Complex as a TT template and parse it.

    [% Data.String  | ReplacePlaceholders("one", "two") %] - Replace Data.String placeholders (i.e. %s) with supplied strings.

    [% Data.Complex | JSON %]                              - Convert Data.Complex into a JSON string.

Functions:

    [% Translate("Test string for %s", "Documentation") %]                - Translate text, with placeholders.

    [% Config("Home") %]                                                  - Get SysConfig configuration value.

    [% Env("Baselink") %]                                                 - Get environment value.

    [% ReplacePlaceholders("This is %s", "<strong>bold text</strong>") %] - Replace string placeholders with supplied values.
Scroll to Top