Files
kupshop/bundles/External/HannahBundle/Util/LegacyUrlGenerator.php
2025-08-02 16:30:27 +02:00

52 lines
1.4 KiB
PHP

<?php
namespace External\HannahBundle\Util;
class LegacyUrlGenerator extends \KupShop\KupShopBundle\Util\LegacyUrlGenerator
{
/** @required */
public Configuration $configuration;
protected function processAll(&$params, &$SERVER_URL, $SEO_URL, $SEO_TITLE): string
{
switch (@$params['s']) {
case 'articles':
if ($url = $this->getCustomUrl($params['s'], (int) $params['IDb'])) {
unset($params['IDb']);
return $url;
}
}
return parent::processAll($params, $SERVER_URL, $SEO_URL, $SEO_TITLE);
}
public function getCustomUrl(string $type, int $id): ?string
{
$map = [
'articles' => [
Configuration::SHOP_HANNAH => [
3 => '/ambasadori/',
1 => '/blog/',
],
Configuration::SHOP_RAFIKI => [
10 => '/ambasadori/',
11 => '/blog/',
],
Configuration::SHOP_KEEN => [
1 => '/blog/',
],
Configuration::SHOP_ROCKPOINT => [
20 => '/blog/',
],
],
];
if ($map[$type][$this->configuration->getShopId()][$id] ?? false) {
return $map[$type][$this->configuration->getShopId()][$id];
}
return null;
}
}