use new templaterenderer because old can't be used

This commit is contained in:
AntonHeinze 2024-12-19 14:21:49 +01:00
parent 47a0759ced
commit 2b0a3dc2a1

View File

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