81 lines
3.2 KiB
PHP
Raw Normal View History

<?php
2024-11-20 18:50:18 +01:00
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\ManufacturerInformation\Modules\Application\Model;
use OxidEsales\Eshop\Application\Model\Manufacturer;
use OxidEsales\Eshop\Core\Field;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface;
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererBridgeInterface;
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererInterface;
2025-01-03 15:11:14 +01:00
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class ManufacturerInfoList extends ManufacturerInfoList_parent
{
2024-11-20 18:50:18 +01:00
/**
* @param Manufacturer|D3ManufacturerLongDesc $oManufacturer
2025-01-03 15:11:14 +01:00
*
2024-11-20 18:50:18 +01:00
* @return void
2025-01-03 15:11:14 +01:00
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
2024-11-20 18:50:18 +01:00
*/
2024-12-19 16:28:29 +01:00
protected function addCategoryFields($oManufacturer): void
2024-11-20 18:50:18 +01:00
{
parent::addCategoryFields($oManufacturer);
/** @var ModuleSettingService $setting */
$setting = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
if ($setting->getBoolean('d3manufacturerinformation_showManufacturertextOnManufacturerPage', 'd3manufacturerinformation')) {
$longdesc = $oManufacturer->d3GetLongdesc( )->getRawValue() ?? '';
$deactivateSmarty = Registry::getConfig()->getConfigParam('deactivateSmartyForCmsContent');
$processLongDescriptions = Registry::getConfig()->getConfigParam('bl_perfParseLongDescinSmarty');
if (!$deactivateSmarty && $processLongDescriptions) {
$viewData = array_merge(
Registry::getConfig()->getActiveView()->getViewData(),
[
'oShop' => Registry::getConfig()->getActiveShop(),
'oViewConf' => Registry::getConfig()->getActiveView()->getViewConfig()
]
);
$longdesc = $this->getRenderer()->renderFragment(
$longdesc,
sprintf('ox:%s%s', $oManufacturer->getId(), $oManufacturer->getLanguage()),
$viewData
) ?? '';
}
2025-01-03 15:02:58 +01:00
$oManufacturer->oxcategories__oxlongdesc = new Field(html_entity_decode($longdesc), Field::T_RAW);
}
2024-11-20 18:50:18 +01:00
}
2025-01-03 15:11:14 +01:00
/**
* @return TemplateRendererInterface
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
private function getRenderer(): TemplateRendererInterface
{
2025-01-03 15:02:58 +01:00
return ContainerFactory::getInstance()->getContainer()->get(TemplateRendererBridgeInterface::class)->getTemplateRenderer();
}
2024-11-20 18:50:18 +01:00
}