Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getTemplateFinder example
$event
=
new
StorefrontRedirectEvent
(
$route
,
$parameters
,
$status
)
;
$this
->container->
get
(
'event_dispatcher'
)
->
dispatch
(
$event
)
;
return
parent::
redirectToRoute
(
$event
->
getRoute
(
)
,
$event
->
getParameters
(
)
,
$event
->
getStatus
(
)
)
;
}
/** * @param array<string, mixed> $parameters */
protected
function
renderView
(
string
$view
, array
$parameters
=
[
]
)
: string
{
$view
=
$this
->
getTemplateFinder
(
)
->
find
(
$view
)
;
if
(
$this
->twig !== null
)
{
try
{
return
$this
->twig->
render
(
$view
,
$parameters
)
;
}
catch
(
LoaderError|RuntimeError|SyntaxError
$e
)
{
throw
StorefrontException::
cannotRenderView
(
$view
,
$e
->
getMessage
(
)
,
$parameters
)
;
}
}
throw
StorefrontException::
dontHaveTwigInjected
(
static
::
class
)
;
}