Actions

Theme editor - Available Twig functions: Difference between revisions

From LimeSurvey Manual

(Update page)
Line 14: Line 14:
= Specific function for LimeSurvey =
= Specific function for LimeSurvey =


== processString ==
== Text update and management
 
=== flatString ==
 
== ellipsizeString ==
 
== Language management ==
 
=== gT ===
 
=== ngT ===
 
== Get information ==
 
=== getConfig ===
Get the current config part for this instance of LimeSurvey for the parameter. Return the existing config, false if not set.
 
=== getPost ===
Get the current $_POST value for the parameter. Return the existing $_POST, null if not set.
 
=== getQuery ===
Get the current $_GET value for the parameter. Return the existing $_POST, null if not set.
 
=== getParam ===
Get the current $_PARAM value for the parameter. Return the existing $_POST, null if not set.
 
=== processString ===


Process Expression Manager with any string with current page information, return a string.  
Process Expression Manager with any string with current page information, return a string.  
Line 23: Line 49:
* an array of string: replacement out of current expression know vars. The jey is the value to be replaced, the value is the replacement.
* an array of string: replacement out of current expression know vars. The jey is the value to be replaced, the value is the replacement.


== getAllAnswers ==
== Script and css management ==
 
* registerPublicCssFile
* registerTemplateCssFile
* registerGeneralScript
* registerTemplateScript
* registerScript
* registerPackage
* unregisterPackage
* registerCssFile
* registerScriptFile
* unregisterScriptFile
* unregisterScriptForAjax
* listCoreScripts
* listScriptFiles
 
== Others ==
 
=== getAllAnswers ===


Return an array with all current response of the survey in parameters.
Return an array with all current response of the survey in parameters.
Parameters are
Parameters are
* The surveId to get response
* The surveId to get response
=== getAllTokenAnswers ===


= Adding a function =
= Adding a function =

Revision as of 09:55, 27 February 2019

Php included function

Specific function for LimeSurvey

== Text update and management

= flatString

ellipsizeString

Language management

gT

ngT

Get information

getConfig

Get the current config part for this instance of LimeSurvey for the parameter. Return the existing config, false if not set.

getPost

Get the current $_POST value for the parameter. Return the existing $_POST, null if not set.

getQuery

Get the current $_GET value for the parameter. Return the existing $_POST, null if not set.

getParam

Get the current $_PARAM value for the parameter. Return the existing $_POST, null if not set.

processString

Process Expression Manager with any string with current page information, return a string. Parameters are

  • the string to be processed
  • a boolean : return static string (or not), default to no.
  • an integer : recursion (max) level to do, default to 3
  • an array of string: replacement out of current expression know vars. The jey is the value to be replaced, the value is the replacement.

Script and css management

  • registerPublicCssFile
  • registerTemplateCssFile
  • registerGeneralScript
  • registerTemplateScript
  • registerScript
  • registerPackage
  • unregisterPackage
  • registerCssFile
  • registerScriptFile
  • unregisterScriptFile
  • unregisterScriptForAjax
  • listCoreScripts
  • listScriptFiles

Others

getAllAnswers

Return an array with all current response of the survey in parameters. Parameters are

  • The surveId to get response

getAllTokenAnswers

Adding a function

You can add any PHP existing function easily in your config.php file. This is done adding the function in twigRenderer.

		'twigRenderer' => array(
			'functions' => array(
				'strlen' => 'strlen',
			),
			'sandboxConfig' => array(
				'functions' => array(
					'strlen',
				),
			),
		),