Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setExternalLink example
if
(
isset
(
$data
[
'__category_template'
]
)
)
{
$category
->
setTemplate
(
$data
[
'__category_template'
]
)
;
}
if
(
isset
(
$data
[
'__category_blog'
]
)
)
{
$category
->
setBlog
(
(bool)
$data
[
'__category_blog'
]
)
;
}
if
(
isset
(
$data
[
'__category_external'
]
)
)
{
$category
->
setExternalLink
(
$data
[
'__category_external'
]
)
;
}
if
(
isset
(
$data
[
'__category_external_target'
]
)
)
{
$category
->
setExternalTarget
(
$data
[
'__category_external_target'
]
)
;
}
if
(
isset
(
$data
[
'__category_hidefilter'
]
)
)
{
$category
->
setDisplayFacets
(
(bool)
!
$data
[
'__category_hidefilter'
]
)
;
}
if
(
isset
(
$data
[
'__category_hidetop'
]
)
)
{
public
function
testLinkType
(
?string
$type
, string
$route
)
: void
{
$category
=
new
CategoryEntity
(
)
;
$category
->
setType
(
CategoryDefinition::TYPE_LINK
)
;
$category
->
setLinkType
(
$type
)
;
$category
->
addTranslated
(
'linkType',
$type
)
;
static
::
assertNull
(
$this
->urlGenerator->
generate
(
$category
,
$this
->salesChannel
)
)
;
$category
->
setExternalLink
(
self::EXTERNAL_URL
)
;
$category
->
addTranslated
(
'externalLink',
$category
->
getExternalLink
(
)
)
;
$category
->
setInternalLink
(
Uuid::
randomHex
(
)
)
;
$category
->
addTranslated
(
'internalLink',
$category
->
getInternalLink
(
)
)
;
static
::
assertSame
(
$route
,
$this
->urlGenerator->
generate
(
$category
,
$this
->salesChannel
)
)
;
}
public
static
function
dataProviderLinkTypes
(
)
: array
{
return
[
[
CategoryDefinition::LINK_TYPE_PRODUCT, 'frontend.detail.page'
]
,
[