Actions

GetPluginTwigPath: Difference between revisions

From LimeSurvey Manual

No edit summary
(registerQuick sample)
 
Line 26: Line 26:
</syntaxhighlight>
</syntaxhighlight>


'''Sample'''
* [https://gitlab.com/SondagesPro/SurveyAccess/registerQuick registerQuick] with usage of replace and add
[[Category:Plugins events]]
[[Category:Plugins events]]

Latest revision as of 17:46, 20 April 2020

 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));
    }

Sample