Actions

GetPluginTwigPath: Difference between revisions

From LimeSurvey Manual

m (It's wiki not markdown …)
No edit summary
Line 15: Line 15:


'''usage'''
'''usage'''
<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
     public function getPluginTwigPath()
     public function getPluginTwigPath()

Revision as of 16:16, 11 October 2018

 Hint: This features is available starting in version 3.10.0


Usage

This event allow plugin to add directory inside twig system. This directory can be read at start : allowing to replace any template twig file or at end to add new twig file.

Input

Nothing

Possible output

  • add : array of new directory readed after all template twig file
  • replace : array of new directory readed before all template twig file

usage

    public function getPluginTwigPath()
    {
        $viewPath = dirname(__FILE__)."/views"; // All twig file inside this directory (and subdirectory) can be used in any template
        $forcedPath = dirname(__FILE__)."/forced"; // All twig file inside this directory  (and subdirectory)  are used in any template
        $this->getEvent()->append('add', array($viewPath));
        $this->getEvent()->append('replace', array($forcedPath));
    }