Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
WrappedTemplatedEmail example
// email has already been rendered
return
;
}
$messageContext
=
$message
->
getContext
(
)
;
if
(
isset
(
$messageContext
[
'email'
]
)
)
{
throw
new
InvalidArgumentException
(
sprintf
(
'A "%s" context cannot have an "email" entry as this is a reserved variable.',
get_debug_type
(
$message
)
)
)
;
}
$vars
=
array_merge
(
$this
->context,
$messageContext
,
[
'email' =>
new
WrappedTemplatedEmail
(
$this
->twig,
$message
)
,
]
)
;
if
(
$template
=
$message
->
getTextTemplate
(
)
)
{
$message
->
text
(
$this
->twig->
render
(
$template
,
$vars
)
)
;
}
if
(
$template
=
$message
->
getHtmlTemplate
(
)
)
{
$message
->
html
(
$this
->twig->
render
(
$template
,
$vars
)
)
;
}
$message
->
markAsRendered
(
)
;