/**
* @param array<Category> $categories
*
* @return array<array<string, mixed>>
*/
private function convertCategories(array
$categories): array
{ $converter =
$this->
get(LegacyStructConverter::
class);
$eventManager =
$this->
get('events'
);
return array_map(function DCategory
$category) use ($converter,
$eventManager) { $convertedCategory =
$converter->
convertCategoryStruct($category);
$convertedCategory['flag'
] = false;
if ($category->
getMedia()) { $convertedCategory['media'
]['path'
] =
$category->
getMedia()->
getFile();
} if (!
empty($category->
getExternalLink())) { $convertedCategory['link'
] =
$category->
getExternalLink();
} return $eventManager->
filter('Shopware_Plugins_AdvancedMenu_ConvertCategory',
$convertedCategory,
[ 'category' =>
$category,
]);