CodeExplorer getDetachedShop example
$shops =
$this->
getLanguageShops($contextService->
getShop());
$config =
clone $this->config;
if (\
count($shops) === 1
) { return [];
} $hrefs =
[];
foreach ($shops as $languageShop) { $shop =
$this->
getDetachedShop($languageShop['id'
]);
$config->
setShop($shop);
$href =
new HrefLang();
$href->
setShopId($languageShop['id'
]);
$href->
setLocale($languageShop['locale'
]);
$routingContext =
$this->
getContext($shop,
$config);
$href->
setLink($this->
filterUrl((string) $this->rewriteRouter->
assemble($parameters,
$routingContext),
$parameters));
if (!
$config->
get('hrefLangCountry'
)) { $href->
setLocale(explode('-',
$languageShop['locale'
])[0
]);
}