Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getServiceMenu example
$contextLanguage
=
$languages
->
get
(
$context
->
getContext
(
)
->
getLanguageId
(
)
)
;
if
(
!
$contextLanguage
)
{
throw
new
\
RuntimeException
(
sprintf
(
'Context language with id %s not found',
$context
->
getContext
(
)
->
getLanguageId
(
)
)
)
;
}
$page
=
new
HeaderPagelet
(
$navigation
,
$languages
,
$currencies
,
$contextLanguage
,
$context
->
getCurrency
(
)
,
$this
->
getServiceMenu
(
$context
)
)
;
$this
->eventDispatcher->
dispatch
(
new
HeaderPageletLoadedEvent
(
$page
,
$context
,
$request
)
)
;
return
$page
;
}
private
function
getServiceMenu
(
SalesChannelContext
$context
)
: CategoryCollection
{
$serviceId
=
$context
->
getSalesChannel
(
)
->
getServiceCategoryId
(
)
;