Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
AppScriptConditionHook example
$twig
->
addExtension
(
new
PhpSyntaxExtension
(
)
)
;
$twig
->
addExtension
(
new
ComparisonExtension
(
)
)
;
$twig
->
addExtension
(
new
PcreExtension
(
)
)
;
$twig
->
addExtension
(
new
ReplaceRecursiveFilter
(
)
)
;
if
(
$this
->debug
)
{
$twig
->
addExtension
(
new
DebugExtension
(
)
)
;
}
$twig
->
addExtension
(
new
SecurityExtension
(
[
]
)
)
;
$hook
=
new
AppScriptConditionHook
(
$scope
->
getContext
(
)
)
;
try
{
return
$this
->
render
(
$twig
,
$script
,
$hook
,
$name
,
$context
)
;
}
catch
(
\Throwable
$e
)
{
throw
new
ScriptExecutionFailedException
(
$hook
->
getName
(
)
,
$script
->
getName
(
)
,
$e
)
;
}
}
/** * @return array<string, Constraint[]> */