66 lines
2.6 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\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
{
2024-11-20 18:50:18 +01:00
/**
* @param Manufacturer|D3ManufacturerLongDesc $oManufacturer
* @return void
*/
protected function addCategoryFields($oManufacturer)
{
parent::addCategoryFields($oManufacturer);
/** @var ModuleSettingService $setting */
$setting = ContainerFactory::getInstance()->getContainer()->get(ModuleSettingServiceInterface::class);
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 = $this->getRenderer()->renderFragment(
$longdesc,
$oManufacturer->getId() . $oManufacturer->getLanguage(),
[],
true
) ?? '';
}
$oManufacturer->oxcategories__oxlongdesc = new Field(html_entity_decode($longdesc), Field::T_RAW);
}
2024-11-20 18:50:18 +01:00
}
private function getRenderer(): TemplateRendererInterface
{
return $this->getContainer()->get(TemplateRendererBridgeInterface::class)->getTemplateRenderer();
}
2024-11-20 18:50:18 +01:00
}