Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ensureConfigIsLoaded example
private
function
mediaCanHaveThumbnails
(
MediaEntity
$media
, Context
$context
)
: bool
{
if
(
!
$media
->
hasFile
(
)
)
{
return
false;
}
if
(
!
$this
->
thumbnailsAreGeneratable
(
$media
)
)
{
return
false;
}
$this
->
ensureConfigIsLoaded
(
$media
,
$context
)
;
if
(
$media
->
getMediaFolder
(
)
=== null ||
$media
->
getMediaFolder
(
)
->
getConfiguration
(
)
=== null
)
{
return
false;
}
return
$media
->
getMediaFolder
(
)
->
getConfiguration
(
)
->
getCreateThumbnails
(
)
;
}
private
function
thumbnailsAreGeneratable
(
MediaEntity
$media
)
: bool
{
return
$media
->
getMediaType
(
)
instanceof ImageType