$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;
} $themeData['translations'
] =
$this->
getTranslationsConfiguration($configuration,
$context);
$updatedData =
$this->
updateMediaInConfiguration($theme,
$configuration,
$context);
$themeData =
array_merge($themeData,
$updatedData);
if (!
empty($configuration->
getConfigInheritance())) { $themeData =
$this->
addParentTheme($configuration,
$themeData,
$context);
} $writtenEvent =
$this->themeRepository->
upsert([$themeData],
$context);
if (empty($themeData['id'
])) { $themeData['id'
] =
current($writtenEvent->
getPrimaryKeys(ThemeDefinition::ENTITY_NAME
));
}