Skip to content

Commit

Permalink
Dev: prepared LS_Twig_Extension (direct goal: add functions to regist…
Browse files Browse the repository at this point in the history
…er css/js with or without asset manager depending on debug mode)
  • Loading branch information
LouisGac committed Jan 9, 2017
1 parent 54f6de1 commit b81e9a6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion application/config/internal.php
Expand Up @@ -198,6 +198,7 @@
),
// Those extensions, include the sendbox, will be done later in the process
'extensions' => array(
'LS_Twig_Extension',
'Twig_Extension_Sandbox',
'Twig_Extension_StringLoader',
'Twig_Extension_Debug',
Expand All @@ -210,6 +211,7 @@
'getLanguageData' => 'viewHelper::getLanguageData',
'array_flip' => 'array_flip',
'array_intersect_key' => 'array_intersect_key',
'registerPublicCssFile' => 'LS_Twig_Extension::registerPublicCssFile'
),
'filters' => array(
'jencode' => 'CJSON::encode',
Expand All @@ -228,7 +230,7 @@
'ETwigViewRendererYiiCoreStaticClassesProxy'=>array("Html"),
'LSYii_Application' => array("request"),
),
'functions' => array('include', 'dump', 'flatEllipsizeText', 'getLanguageData', 'array_flip', 'array_intersect_key')
'functions' => array('include', 'dump', 'flatEllipsizeText', 'getLanguageData', 'array_flip', 'array_intersect_key', 'registerPublicCssFile')
)

// Change template syntax to Smarty-like (not recommended)
Expand Down
9 changes: 9 additions & 0 deletions application/core/LS_Twig_Extension.php
@@ -0,0 +1,9 @@
<?php
class LS_Twig_Extension extends Twig_Extension
{

static public function registerPublicCssFile($value)
{
Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . $value);
}
}
2 changes: 0 additions & 2 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -295,8 +295,6 @@ public function run($surveyid,$args)
}

if (!(isset($languagechanger) && strlen($languagechanger) > 0) && function_exists('makeLanguageChangerSurvey')){

$languagechanger = makeLanguageChangerSurvey($_SESSION[$LEMsessid]['s_lang'], false, false);
$thissurvey['alanguageChangerDatas'] = makeLanguageChangerSurvey($_SESSION[$LEMsessid]['s_lang'], false, true);
}

Expand Down

0 comments on commit b81e9a6

Please sign in to comment.