Actions

GetPluginTwigPath: Difference between revisions

From LimeSurvey Manual

(Page creation, quick resume)
 
m (It's wiki not markdown …)
Line 11: Line 11:
'''Possible output'''
'''Possible output'''


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


'''usage'''
'''usage'''

Revision as of 18:40, 5 June 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));
    }