<<

NAME

Koha::Template::Plugin::Koha - General Koha Template Toolkit plugin

SYNOPSIS

This plugin contains various Koha replated Template Toolkit functions to help streamline Koha and to move logic from the Perl code into the Templates when it makes sense to do so.

To use, first, include the line '[% USE Koha %]' at the top of the template to enable the plugin.

For example: [% IF Koha.Preference( 'MyPreference ) == 'SettingA' %] removes the necessity of setting a template variable in Perl code for each and every system preference, even if no evaluation of the setting is necessary.

API

Class Methods

new

This new method allows us to store the context which gives us access to the template vars already set. In particular this gives us access to the template vars set by C4::Auth::get_template_and_user

CSVDelimiter

The delimiter option 'tabs' is stored in the DB as 'tabulation' to avoid issues storing special characters in the DB. This helper function translates the value to the correct character when used in templates.

You can, optionally, pass a value parameter to this routine in the case of delimiter being fetched in the scripts and still needing to be translated

GenerateCSRF

Generate a new CSRF token.

<<