Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setConfigInheritance example
if
(
\
array_key_exists
(
'config',
$data
)
)
{
$config
->
setThemeConfig
(
$data
[
'config'
]
)
;
}
if
(
\
array_key_exists
(
'views',
$data
)
)
{
$config
->
setViewInheritance
(
$data
[
'views'
]
)
;
}
if
(
\
array_key_exists
(
'configInheritance',
$data
)
)
{
$config
->
setConfigInheritance
(
$data
[
'configInheritance'
]
)
;
$baseConfig
=
$config
->
getThemeConfig
(
)
;
$baseConfig
[
'configInheritance'
]
=
$data
[
'configInheritance'
]
;
$config
->
setThemeConfig
(
$baseConfig
)
;
}
if
(
\
array_key_exists
(
'iconSets',
$data
)
)
{
$config
->
setIconSets
(
$data
[
'iconSets'
]
)
;
}
}
catch
(
\Throwable
)
{
$config
=
new
StorefrontPluginConfiguration
(
$name
)
;
}
$themeDefaultFolderId
=
$this
->
getThemeMediaDefaultFolderId
(
)
;
foreach
(
$themeEntity
->
getMedia
(
)
as
$media
)
{
static
::
assertEquals
(
$themeDefaultFolderId
,
$media
->
getMediaFolderId
(
)
)
;
}
}
public
function
testThemeConfigInheritanceAddsParentTheme
(
)
: void
{
$parentBundle
=
$this
->
getThemeConfigWithLabels
(
)
;
$this
->themeLifecycleService->
refreshTheme
(
$parentBundle
,
$this
->context
)
;
$bundle
=
$this
->
getThemeConfig
(
)
;
$bundle
->
setConfigInheritance
(
[
'@' .
$parentBundle
->
getTechnicalName
(
)
]
)
;
$this
->themeLifecycleService->
refreshTheme
(
$bundle
,
$this
->context
)
;
$parentThemeEntity
=
$this
->
getTheme
(
$parentBundle
)
;
$themeEntity
=
$this
->
getTheme
(
$bundle
)
;
static
::
assertEquals
(
$parentThemeEntity
->
getId
(
)
,
$themeEntity
->
getParentThemeId
(
)
)
;
}
public
function
testThemeRefreshWithParentTheme
(
)
: void
{