diff --git a/Modules/Application/Model/ManufacturerInfoList.php b/Modules/Application/Model/ManufacturerInfoList.php index 74f54f7..1302b11 100644 --- a/Modules/Application/Model/ManufacturerInfoList.php +++ b/Modules/Application/Model/ManufacturerInfoList.php @@ -17,11 +17,15 @@ declare(strict_types=1); namespace D3\ManufacturerInformation\Modules\Application\Model; -use D3\ManufacturerInformation\Application\Model\Constants; use OxidEsales\Eshop\Application\Model\Manufacturer; -use OxidEsales\Eshop\Application\Model\ManufacturerList; use OxidEsales\Eshop\Core\Field; use OxidEsales\Eshop\Core\Registry; +use OxidEsales\Eshop\Core\UtilsView; +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; class ManufacturerInfoList extends ManufacturerInfoList_parent { @@ -33,23 +37,29 @@ class ManufacturerInfoList extends ManufacturerInfoList_parent { parent::addCategoryFields($oManufacturer); - if (Registry::getConfig()->getConfigParam('d3manufacturerinformation_showManufacturertextOnManufacturerPage')) { - /** @var \OxidEsales\Eshop\Core\UtilsView $oUtilsView */ - $oUtilsView = Registry::getUtilsView(); + /** @var ModuleSettingService $setting */ + $setting = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class); - $longdesc = $oManufacturer->d3GetLongdesc()->getRawValue() ?? ''; + if ($setting->getBoolean('d3manufacturerinformation_showManufacturertextOnManufacturerPage', 'd3manufacturerinformation')) { + /** @var UtilsView $oUtilsView */ + $oUtilsView = Registry::getUtilsView(); + $longdesc = $oManufacturer->d3GetLongdesc( )->getRawValue() ?? ''; $deactivateSmarty = Registry::getConfig()->getConfigParam('deactivateSmartyForCmsContent'); $processLongDescriptions = Registry::getConfig()->getConfigParam('bl_perfParseLongDescinSmarty'); if (!$deactivateSmarty && $processLongDescriptions) { - $longdesc = $oUtilsView->parseThroughSmarty( + $longdesc = $this->getRenderer()->renderFragment( $longdesc, $oManufacturer->getId() . $oManufacturer->getLanguage(), - null, + [], true ) ?? ''; } - $oManufacturer->oxcategories__oxlongdesc = new Field(html_entity_decode($longdesc), Field::T_RAW); } } + + private function getRenderer(): TemplateRendererInterface + { + return $this->getContainer()->get(TemplateRendererBridgeInterface::class)->getTemplateRenderer(); + } }