
########
Provider
########


****
NAME
****


Kernel::Output::Template::Provider - Template Toolkit custom provider


****************
PUBLIC INTERFACE
****************


OTRSInit()
==========


performs some post-initialization and creates a bridge between Template::Toolkit
and OTRS by adding the OTRS objects to the Provider object. This method must be
called after instantiating the Provider object.

Please note that we only store a weak reference to the LayoutObject to avoid ring
references.


_fetch()
========


try to get a compiled version of a template from the CacheObject,
otherwise compile the template and return it.

Copied and slightly adapted from Template::Provider.

A note about caching: we have three levels of caching.


.. code-block:: perl

     1. we have an in-memory cache that stores the compiled Document objects (fastest).
     2. we store the parsed data in the CacheObject to be re-used in another request.
     3. for string templates, we have an in-memory cache in the parsing method _compile().
         It will return the already parsed object if it sees the same template content again.



_load()
=======


calls our pre processor when loading a template.

Inherited from Template::Provider.


_compile()
==========


compiles a .tt template into a Perl package and uses the CacheObject
to cache it.

Copied and slightly adapted from Template::Provider.


store()
=======


inherited from Template::Provider. This function override just makes sure that the original
in-memory cache cannot be used.


_PreProcessTemplateContent()
============================


this is our template pre processor.

It handles some OTRS specific tags like [% InsertTemplate("TemplateName.tt") %]
and also performs compile-time code injection (ChallengeToken element into forms).

Besides that, it also makes sure the template is treated as UTF8.

This is run at compile time. If a template is cached, this method does not have to be executed on it
any more.




