foreach ($configurationCollection as $config) { $this->
refreshTheme($config,
$context);
} } public function refreshTheme(StorefrontPluginConfiguration
$configuration, Context
$context): void
{ $themeData =
[];
$themeData['name'
] =
$configuration->
getName();
$themeData['technicalName'
] =
$configuration->
getTechnicalName();
$themeData['author'
] =
$configuration->
getAuthor();
$themeData['themeJson'
] =
$configuration->
getThemeJson();
// refresh theme after deleting media
$theme =
$this->
getThemeByTechnicalName($configuration->
getTechnicalName(),
$context);
// check if theme config already exists in the database
if ($theme) { $themeData['id'
] =
$theme->
getId();
} else { $themeData['active'
] = true;
}