Skip to content

Commit

Permalink
Dev: added unregisterPackage() to Twig Extension
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jun 29, 2017
1 parent 134a3c4 commit 4a21b79
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 3 additions & 1 deletion application/config/internal.php
Expand Up @@ -218,6 +218,8 @@
'registerGeneralScript' => 'LS_Twig_Extension::registerGeneralScript',
'registerTemplateScript' => 'LS_Twig_Extension::registerTemplateScript',
'registerScript' => 'LS_Twig_Extension::registerScript',
'unregisterPackage' => 'LS_Twig_Extension::unregisterPackage',
'listCoreScripts' => 'LS_Twig_Extension::listCoreScripts',
'getAllQuestionClasses' => 'LS_Twig_Extension::getAllQuestionClasses',
'intval' => 'intval',
'empty' => 'empty',
Expand Down Expand Up @@ -252,7 +254,7 @@
'ETwigViewRendererYiiCoreStaticClassesProxy' => array("Html"),
'LSYii_Application' => array("request"),
),
'functions' => array('include', 'dump', 'flatEllipsizeText', 'getLanguageData', 'array_flip', 'array_intersect_key', 'registerPublicCssFile', 'registerTemplateCssFile', 'registerGeneralScript', 'registerTemplateScript', 'registerScript', 'getAllQuestionClasses','intval', 'count', 'empty', 'reset', 'renderCaptcha', 'getPost','getParam', 'getQuery', 'isset', 'str_replace', 'assetPublish', 'image', 'sprintf', 'gT' ),
'functions' => array('include', 'dump', 'flatEllipsizeText', 'getLanguageData', 'array_flip', 'array_intersect_key', 'registerPublicCssFile', 'registerTemplateCssFile', 'registerGeneralScript', 'registerTemplateScript', 'registerScript', 'unregisterPackage', 'listCoreScripts', 'getAllQuestionClasses','intval', 'count', 'empty', 'reset', 'renderCaptcha', 'getPost','getParam', 'getQuery', 'isset', 'str_replace', 'assetPublish', 'image', 'sprintf', 'gT' ),
),

),
Expand Down
19 changes: 18 additions & 1 deletion application/core/LS_Twig_Extension.php
Expand Up @@ -229,7 +229,7 @@ public static function image($sImagePath, $alt='', $htmlOptions=array ( ) )
public static function getTemplateForRessource($sRessource)
{
$oRTemplate = Template::model()->getInstance();

while (!file_exists($oRTemplate->path.'/'.$sRessource)){

$oMotherTemplate = $oRTemplate->oMotherTemplate;
Expand Down Expand Up @@ -258,5 +258,22 @@ public static function getQuery($sName, $sDefaultValue=null)
return Yii::app()->request->getQuery($sName, $sDefaultValue);
}

public static function unregisterPackage($name)
{
return Yii::app()->getClientScript()->unregisterPackage($name);
}

public static function listCoreScripts()
{
foreach(Yii::app()->getClientScript()->coreScripts as $key => $package){

echo "<hr>";
echo "$key: <br>";
var_dump($package);

}

}


}

0 comments on commit 4a21b79

Please sign in to comment.