Skip to content

Commit

Permalink
Dev: removed doFRender. Now, editing twig files is enough to change a…
Browse files Browse the repository at this point in the history
…ny HTML part of the template.
  • Loading branch information
LouisGac committed May 5, 2017
1 parent 4856a6b commit da4f90c
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions application/helpers/frontend_helper.php
Expand Up @@ -2286,38 +2286,6 @@ function getSideBodyClass($sideMenustate = false)
return $class;
}


/**
* Render the question view.
* @deprecated this function was not used here , we render , not renderPartial
* By default, it just renders the required core view from application/views/survey/...
* If the Survey template is configured to overwrite the question views, then the function will check if the required view exist in the template directory
* and then will use this one to render the question.
*
* @param string $sView name of the view to be rendered.
* @param array $aData data to be extracted into PHP variables and made available to the view script
* @param boolean $bReturn whether the rendering result should be returned instead of being displayed to end users (should be always true)
*/
function doFRender($sView, $aData, $bReturn=true)
{
global $thissurvey;
if(isset($thissurvey['template']))
{
$sTemplate = $thissurvey['template'];
$oTemplate = Template::model()->getInstance($sTemplate); // we get the template configuration
if($oTemplate->overwrite_question_views===true && Yii::app()->getConfig('allow_templates_to_overwrite_views')) // If it's configured to overwrite the views
{
$requiredView = $oTemplate->viewPath.ltrim($sView, '/'); // Then we check if it has its own version of the required view
if( file_exists($requiredView.'.php') ) // If it the case, the function will render this view
{
Yii::setPathOfAlias('survey.template.view', $requiredView); // to render a view from an absolute path outside of application/, path alias must be used.
$sView = 'survey.template.view'; // See : http://www.yiiframework.com/doc/api/1.1/CController#getViewFile-detail
}
}
}
return Yii::app()->getController()->renderPartial($sView, $aData, $bReturn);
}

/**
* For later use, don't remove.
* @return array<string>
Expand Down

0 comments on commit da4f90c

Please sign in to comment.