Skip to content

Commit

Permalink
Dev: moved twig rendering at the end of templatereplace() to get the …
Browse files Browse the repository at this point in the history
…all the defined vars
  • Loading branch information
LouisGac committed Dec 16, 2016
1 parent b48a92d commit b04c11b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions application/helpers/replacements_helper.php
Expand Up @@ -31,8 +31,6 @@
*/
function templatereplace($line, $replacements = array(), &$redata = array(), $debugSrc = 'Unspecified', $anonymized = false, $questionNum = NULL, $registerdata = array(), $bStaticReplacement = false, $oTemplate='')
{
$line = Yii::app()->twigRenderer->renderTemplateFromString( $line, $redata, false);

$allowedvars = array(
'assessments',
'captchapath',
Expand Down Expand Up @@ -613,6 +611,9 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
{
$doTheseReplacements = $coreReplacements;
}

$redata = compact(array_keys(get_defined_vars()));
$line = Yii::app()->twigRenderer->renderTemplateFromString( $line, $redata, false);

// Now do all of the replacements - In rare cases, need to do 3 deep recursion, that that is default
$line = LimeExpressionManager::ProcessString($line, $questionNum, $doTheseReplacements, false, 3, 1, false, true, $bStaticReplacement);
Expand Down

0 comments on commit b04c11b

Please sign in to comment.