Twig view renderer, LimeSurvey overload
Allow to run sandbox Configuration Provide different render methods for different context:
The only tricky point here is the path problematic (where should be searched the views to render?)
see | |
---|---|
author | Leonid Svyatov leonid@svyatov.ru |
author | Alexander Makarov sam@rmcreative.ru |
link | |
link | |
version | 1.1.15 |
package | Default |
addExtensions(array $extensions)
It's different from the original Yii Twig Extension to take in account our custom sand box
array
@see self::$extensions
addRecursiveTemplatesPath(\TemplateConfiguration $oTemplate,array<mixed,string> $extraPaths = array(),string|null $dirName = null)
array<mixed,string>
to be added before template, parent template plugin add and core views. Example : question template
string|null
directory name to be added as extra directory inside template view
convertTwigToHtml(string $sString,array $aData = array(),\TemplateConfiguration|null $oTemplate = null): string
Throws |
|
---|
string
The string of HTML/Twig to convert
array
Array containing the datas needed to render the view ($thissurvey)
\TemplateConfiguration|null
string
fixDataCoherence(array $aData): array
array
array
getAdditionalInfos( $aData,\TemplateConfiguration $oTemplate):
TODO: move all the display logic to surveyRuntime so we don't need this function here
\TemplateConfiguration
getLoader(): \FileLoader
\FileLoader
getPathOfFile(string $twigView,\TemplateConfiguration $oTemplate = null,array<mixed,string> $extraPath = array(),string|null $dirName = null): string
Throws |
|
---|
string
twigfile to be used (with twig extension)
\TemplateConfiguration
array<mixed,string>
path to be added before plugins add and core views
string|null
directory name to be added as extra directory inside template view
string
complete filename to be used
getPluginsData(string $sString,array $aData): array
string
array
array
getTemplateForView(string $sView,\TemplateConfiguration $oRTemplate): \Template|boolean
renderAnswerOptions(string $sView,array $aData): string
It first checks if the question use a template (set in display attributes) If it is the case, it will use the views of that template, else, it will render the core view.
Throws |
|
---|
string
the view (layout) to render
array
the datas needed for the view rendering
string
the generated html
renderHtmlPage(string $sHtml,\Template $oTemplate)
string
The Html content of the page (it must not contain anymore any twig statement)
renderOptionPage(\Template $oTemplate,array $renderArray = array()): string
Throws |
|
---|
array
Array that will be passed to the options.twig as variables.
string
renderPartial(string $twigView,array $aData): string
todo | find a way to fix in beforeCloseHtml @see https://bugs.limesurvey.org/view.php?id=13889 |
---|---|
Throws |
|
string
twigfile to be used (with twig extension)
array
to be used
string
renderQuestion(string $sView,array $aData): string
It first checks if the question use a template (set in display attributes) If it is the case, it will use the views of that template, else, it will render the core view.
Throws |
|
---|
string
the view (layout) to render
array
the datas needed for the view rendering
string
the generated html
renderTemplateForQuestionEditPreview(string $sLayout,array $aData,boolean $root = false,boolean $bReturn = false): mixed|string
Throws |
|
---|
string
the name of the layout to render
array
the datas needed to fill the layout
boolean
boolean
if true, it will return the html string without rendering the whole page. Usefull for debuging, and used for Print Answers
mixed|string
renderTemplateForTemplateEditor(string $sView,array $aData,\Template $oEditedTemplate): string
It returns the HTML string needed for the tmp file using the template twig file.
todo | missing return statement (php warning) |
---|---|
Throws |
|
string
the view (layout) to render
array
the datas needed for the view rendering
string
the generated html
renderTemplateFromFile(string $sLayout,array $aData,boolean $bReturn): mixed|string
Throws |
|
---|
string
the name of the layout to render
array
the datas needed to fill the layout
boolean
if true, it will return the html string without rendering the whole page. Usefull for debuging, and used for Print Answers
mixed|string
renderViewFromFile( $sLayoutFilePath,array $aData,boolean $bReturn = false,boolean $bUseRootDir = true): string
Extendable to use admin templates in the future currently running on pathes, like the yii render methods go.
todo | missing return statement (php warning) |
---|---|
Throws |
|
array
the datas needed to fill the layout
boolean
if true, it will return the html string without rendering the whole page. Usefull for debuging, and used for Print Answers
boolean
Prepend application root dir to sLayoutFilePath if true.
string
HTML
sandboxConfig :array
var | Twig_Extension_Sandbox configuration |
---|
array
_twig :\Twig_Environment|null
var |
---|
\Twig_Environment|null