From fde3914da2bb94611e3b4a5872c9efca60d3c978 Mon Sep 17 00:00:00 2001 From: LouisGac Date: Tue, 23 May 2017 16:29:40 +0200 Subject: [PATCH] Dev: removed setForcedPath logic (replace by inheritance inclusion) --- application/controllers/SurveysController.php | 2 -- application/controllers/survey/index.php | 1 - application/core/LSETwigViewRenderer.php | 12 ------------ application/helpers/SurveyRuntimeHelper.php | 1 - application/helpers/frontend_helper.php | 1 - 5 files changed, 17 deletions(-) diff --git a/application/controllers/SurveysController.php b/application/controllers/SurveysController.php index 20820ffe191..b77cb7fd102 100644 --- a/application/controllers/SurveysController.php +++ b/application/controllers/SurveysController.php @@ -58,8 +58,6 @@ public function actionPublicList($lang = null) Yii::app()->clientScript->registerScriptFile(Yii::app()->getConfig("generalscripts").'nojs.js',CClientScript::POS_HEAD); $sTemplateViewPath = $oTemplate->viewPath; - - Yii::app()->twigRenderer->setForcedPath($sTemplateViewPath); Yii::app()->twigRenderer->renderTemplateFromString( file_get_contents($sTemplateViewPath."layout_survey_list.twig"), array('aSurveyInfo'=>$aData), false); } diff --git a/application/controllers/survey/index.php b/application/controllers/survey/index.php index 0a683315d0a..271b620fa89 100644 --- a/application/controllers/survey/index.php +++ b/application/controllers/survey/index.php @@ -408,7 +408,6 @@ function action() $aLoadForm['aErrors'] = empty($aLoadErrorMsg) ? null : $aLoadErrorMsg; // Set tit to null if empty $thissurvey['aLoadForm'] = $aLoadForm; - Yii::app()->twigRenderer->setForcedPath($oTemplate->viewPath); $oTemplate->registerAssets(); Yii::app()->twigRenderer->renderTemplateFromString( file_get_contents($oTemplate->viewPath."layout_load.twig"), array('aSurveyInfo'=>$thissurvey), false); } diff --git a/application/core/LSETwigViewRenderer.php b/application/core/LSETwigViewRenderer.php index 7ee9f32c795..7e52f1f8b22 100644 --- a/application/core/LSETwigViewRenderer.php +++ b/application/core/LSETwigViewRenderer.php @@ -26,7 +26,6 @@ class LSETwigViewRenderer extends ETwigViewRenderer */ public $sandboxConfig = array(); private $_twig; - private $forcedPath = null; /** * Adds custom extensions @@ -137,17 +136,6 @@ public function renderQuestion( $sView, $aData) } } - /** - * Only use for renderTemplateFromString for now, to force the path of included twig files (in renderTemplateFromString: the template files) - * It's necessary for the twig include statments: by default, those views would be looked into application/views instead of the template's views directory. - * @param string $sPath the path that will be used to render the views. - */ - public function setForcedPath($sPath) - { - $this->forcedPath=$sPath; - } - - /** * Render a string, not a file. It's used from template replace function. * diff --git a/application/helpers/SurveyRuntimeHelper.php b/application/helpers/SurveyRuntimeHelper.php index 668dd761b50..9172c37d77a 100644 --- a/application/helpers/SurveyRuntimeHelper.php +++ b/application/helpers/SurveyRuntimeHelper.php @@ -1618,7 +1618,6 @@ private function initTemplate() $oTemplate = $this->oTemplate = Template::model()->getInstance('', $this->iSurveyid); $this->sTemplateViewPath = $oTemplate->viewPath; $oTemplate->registerAssets(); - Yii::app()->twigRenderer->setForcedPath($this->sTemplateViewPath); } private function makeLanguageChanger() diff --git a/application/helpers/frontend_helper.php b/application/helpers/frontend_helper.php index c6d65b5d9be..8af2fbd3cff 100644 --- a/application/helpers/frontend_helper.php +++ b/application/helpers/frontend_helper.php @@ -1518,7 +1518,6 @@ function renderError($sTitle='', $sMessage, $thissurvey, $sTemplateViewPath ) $oTemplate = Template::model()->getInstance('', $surveyid); $sTemplateViewPath = $oTemplate->viewPath; $oTemplate->registerAssets(); - Yii::app()->twigRenderer->setForcedPath($sTemplateViewPath); $aError = array(); $aError['title'] = ($sTitle != '')?$sTitle:gT("This survey cannot be tested or completed for the following reason(s):");