Пример #1
0
 /**
  * Transform content and/or content type for the specified preprocessing chain object
  *
  * @param Chain $chain
  * @return void
  */
 public function process(Chain $chain)
 {
     if ($this->config->isEmbeddedStrategy()) {
         $context = $chain->getAsset()->getContext();
         $areaCode = \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE;
         if ($context instanceof FallbackContext) {
             $areaCode = $context->getAreaCode();
             $this->translate->setLocale($context->getLocale());
         }
         $area = $this->areaList->getArea($areaCode);
         $area->load(\Magento\Framework\App\Area::PART_TRANSLATE);
         $chain->setContent($this->translate($chain->getContent()));
     }
 }
Пример #2
0
 /**
  * Transform content and/or content type for the specified preprocessing chain object
  *
  * @param Chain $chain
  * @return void
  */
 public function process(Chain $chain)
 {
     if ($this->config->isEmbeddedStrategy()) {
         $chain->setContent($this->translate($chain->getContent()));
     }
 }
Пример #3
0
 public function testIsEmbeddedStrategy()
 {
     $this->scopeMock->expects($this->once())->method('getValue')->with(Config::XML_PATH_STRATEGY)->willReturn(Config::EMBEDDED_STRATEGY);
     $this->assertTrue($this->model->isEmbeddedStrategy());
 }