GetPluginTwigPath: Difference between revisions
From LimeSurvey Manual
DenisChenu (talk | contribs) m It's wiki not markdown … |
DenisChenu (talk | contribs) registerQuick sample |
||
(One intermediate revision by the same user not shown) | |||
Line 15: | Line 15: | ||
'''usage''' | '''usage''' | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
public function getPluginTwigPath() | public function getPluginTwigPath() | ||
Line 25: | 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
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
- registerQuick with usage of replace and add