Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getExistingBackendEmotionPath example
$view
=
$args
->
getSubject
(
)
->
View
(
)
;
if
(
file_exists
(
$this
->
Path
(
)
. '/Views/emotion_components/'
)
)
{
$view
->
addTemplateDir
(
$this
->
Path
(
)
. '/Views/emotion_components/'
)
;
}
if
(
$args
->
getSubject
(
)
->
Request
(
)
->
getModuleName
(
)
!== 'backend'
)
{
return
;
}
$backendPath
=
$this
->
getExistingBackendEmotionPath
(
)
;
if
(
!\
is_string
(
$backendPath
)
)
{
return
;
}
$directoryIterator
=
new
DirectoryIterator
(
$backendPath
)
;
$regex
=
new
RegexIterator
(
$directoryIterator
, '/^.+\.js$/i', RecursiveRegexIterator::GET_MATCH
)
;
foreach
(
$regex
as
$file
)
{
$path
= 'backend/' .
$file
[
0
]
;
$view
->
extendsBlock
(
'backend/Emotion/app',
PHP_EOL . '{include file="' .
$path
. '"}',