mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 19:48:49 +02:00
Merge branch 'support/3.2' into develop
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -22,7 +23,6 @@ use Twig\Extension\DebugExtension;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
use utils;
|
||||
|
||||
|
||||
/**
|
||||
* Class TwigHelper
|
||||
*
|
||||
@@ -75,7 +75,7 @@ class TwigHelper
|
||||
* @return Environment
|
||||
* @throws \Twig\Error\LoaderError
|
||||
*/
|
||||
public static function GetTwigEnvironment($sViewPath, $aAdditionalPaths = array())
|
||||
public static function GetTwigEnvironment($sViewPath, $aAdditionalPaths = [])
|
||||
{
|
||||
$oLoader = new FilesystemLoader($sViewPath);
|
||||
foreach ($aAdditionalPaths as $sAdditionalPath) {
|
||||
@@ -115,7 +115,7 @@ class TwigHelper
|
||||
* @throws \Exception
|
||||
* @api
|
||||
*/
|
||||
public static function RenderIntoPage(WebPage $oPage, $sViewPath, $sTemplateName, $aParams = array(), $sDefaultType = self::DEFAULT_FILE_TYPE)
|
||||
public static function RenderIntoPage(WebPage $oPage, $sViewPath, $sTemplateName, $aParams = [], $sDefaultType = self::DEFAULT_FILE_TYPE)
|
||||
{
|
||||
$oTwig = self::GetTwigEnvironment($sViewPath);
|
||||
$oTwig->addGlobal('UIBlockParent', [$oPage]);
|
||||
@@ -139,7 +139,7 @@ class TwigHelper
|
||||
* @throws \Twig\Error\LoaderError
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function RenderIntoBlock(WebPage $oPage, UIBlock $oBlock, $sViewPath, $sTemplateName, $aParams = array(), $sDefaultType = self::DEFAULT_FILE_TYPE)
|
||||
public static function RenderIntoBlock(WebPage $oPage, UIBlock $oBlock, $sViewPath, $sTemplateName, $aParams = [], $sDefaultType = self::DEFAULT_FILE_TYPE)
|
||||
{
|
||||
$oTwig = self::GetTwigEnvironment($sViewPath);
|
||||
$oTwig->addGlobal('UIBlockParent', [$oBlock]);
|
||||
@@ -168,8 +168,7 @@ class TwigHelper
|
||||
$oKPI->ComputeStats('Render TWIG', $sFileName);
|
||||
|
||||
return $sResult;
|
||||
}
|
||||
catch (Error $oTwigException) {
|
||||
} catch (Error $oTwigException) {
|
||||
$oTwigPreviousException = $oTwigException->getPrevious();
|
||||
if (!is_null(($oTwigPreviousException)) && ($oTwigPreviousException instanceof CoreTemplateException)) {
|
||||
// handles recursive calls : if we're here, an exception was already raised in a child template !
|
||||
|
||||
Reference in New Issue
Block a user