Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setStorefrontEntryFilepath example
$configCollection
,
false
)
;
// Path is still relative
static
::
assertSame
(
$currentPath
,
$config
->
getStyleFiles
(
)
->
first
(
)
?
$config
->
getStyleFiles
(
)
->
first
(
)
->
getFilepath
(
)
: ''
)
;
$config
->
setScriptFiles
(
new
FileCollection
(
)
)
;
$config
->
setStorefrontEntryFilepath
(
__FILE__
)
;
(
new
ThemeFileResolver
(
new
ThemeFileImporter
(
$projectDir
)
)
)
->
resolveFiles
(
$config
,
$configCollection
,
true
)
;
static
::
assertSame
(
$currentPath
,
$config
->
getStyleFiles
(
)
->
first
(
)
?
$config
->
getStyleFiles
(
)
->
first
(
)
->
getFilepath
(
)
: ''
)
;
}
$pathname
=
$path
. \DIRECTORY_SEPARATOR . 'Resources/theme.json';
$basePath
=
realpath
(
pathinfo
(
$pathname
, \PATHINFO_DIRNAME
)
)
?:
$pathname
;
$basePath
=
$this
->
stripProjectDir
(
$basePath
)
;
$config
=
new
StorefrontPluginConfiguration
(
$name
)
;
$config
->
setThemeJson
(
$data
)
;
$config
->
setBasePath
(
$this
->
stripProjectDir
(
$basePath
)
)
;
$config
->
setStorefrontEntryFilepath
(
$this
->
getEntryFile
(
$path
)
)
;
$config
->
setIsTheme
(
true
)
;
$config
->
setName
(
$data
[
'name'
]
)
;
$config
->
setAuthor
(
$data
[
'author'
]
)
;
if
(
\
array_key_exists
(
'style',
$data
)
&& \
is_array
(
$data
[
'style'
]
)
)
{
$this
->
resolveStyleFiles
(
$data
[
'style'
]
,
$basePath
,
$config
)
;
}
if
(
\
array_key_exists
(
'script',
$data
)
&& \
is_array
(
$data
[
'script'
]
)
)
{
$fileCollection
= FileCollection::
createFromArray
(
$data
[
'script'
]
)
;
$config
->
setScriptFiles
(
$this
->
addBasePathToCollection
(
$fileCollection
,
$basePath
)
)
;
}