![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/mageworx/module-seoxtemplates/Model/Observer/ |
<?php /** * Copyright © MageWorx. All rights reserved. * See LICENSE.txt for license details. */ namespace MageWorx\SeoXTemplates\Model\Observer; use MageWorx\SeoXTemplates\Model\DynamicRenderer\Brand as Renderer; /** * Observer class for brand page template apply process */ class BrandDataModifier implements \Magento\Framework\Event\ObserverInterface { /** * @var \MageWorx\SeoXTemplates\Model\DynamicRenderer\Brand */ protected $dynamicRenderer; /** * @var \Magento\Framework\App\Request\Http */ protected $request; /** * @var \Magento\Framework\Registry */ protected $registry; /** * BrandDataModifier constructor. * @param Renderer $dynamicRenderer * @param \Magento\Framework\App\Request\Http $request * @param \Magento\Framework\Registry $registry */ public function __construct( Renderer $dynamicRenderer, \Magento\Framework\App\Request\Http $request, \Magento\Framework\Registry $registry ) { $this->dynamicRenderer = $dynamicRenderer; $this->request = $request; $this->registry = $registry; } /** * Modify Brand data and meta head * Event: layout_generate_blocks_after * * @param \Magento\Framework\Event\Observer $observer * @return void */ public function execute(\Magento\Framework\Event\Observer $observer) { if ('mageworx_brands_brand_view' == $this->request->getFullActionName()) { $brand = $this->registry->registry('current_brand'); if (is_object($brand)) { $this->dynamicRenderer->modifyBrandTitle($brand); $this->dynamicRenderer->modifyBrandMetaDescription($brand); $this->dynamicRenderer->modifyBrandMetaKeywords($brand); } } } }