Пример #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->isDictionaryPath($chain->getTargetAssetPath())) {
         $context = $chain->getAsset()->getContext();
         $themePath = $context instanceof FallbackContext ? $context->getThemePath() : '*/*';
         $chain->setContent(json_encode($this->dataProvider->getData($themePath)));
         $chain->setContentType('json');
     }
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function process(\Magento\Framework\View\Asset\PreProcessor\Chain $chain)
 {
     $chain->setContentType('less');
     $tmpFile = $this->fileGenerator->generateFileTree($chain);
     $cssContent = $this->adapter->process($tmpFile);
     $cssTrimmedContent = trim($cssContent);
     if (!empty($cssTrimmedContent)) {
         $chain->setContent($cssContent);
     }
     $chain->setContentType('css');
 }
Пример #3
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->isDictionaryPath($chain->getTargetAssetPath())) {
         $context = $chain->getAsset()->getContext();
         $themePath = '*/*';
         $areaCode = \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE;
         if ($context instanceof FallbackContext) {
             $themePath = $context->getThemePath();
             $areaCode = $context->getAreaCode();
             $this->translate->setLocale($context->getLocale());
         }
         $area = $this->areaList->getArea($areaCode);
         $area->load(\Magento\Framework\App\Area::PART_TRANSLATE);
         $chain->setContent(json_encode($this->dataProvider->getData($themePath)));
         $chain->setContentType('json');
     }
 }
Пример #4
0
 /**
  * Transform content and/or content type for the specified preprocessing chain object
  *
  * @param Chain $chain
  * @return void
  */
 public function process(Chain $chain)
 {
     $chain->setContentType($chain->getTargetContentType());
 }
Пример #5
0
 /**
  * A callback for affecting preprocessor chain in the test
  *
  * @param Chain $chain
  */
 public function chainTestCallback(Chain $chain)
 {
     $chain->setContentType('ext');
     $chain->setContent('processed');
 }
Пример #6
0
 /**
  * @param string $content
  * @param string $type
  * @param bool $expected
  * @dataProvider isChangedDataProvider
  */
 public function testIsChanged($content, $type, $expected)
 {
     $this->object->setContent($content);
     $this->object->setContentType($type);
     $this->assertEquals($expected, $this->object->isChanged());
 }
Пример #7
0
 /**
  * A callback for affecting preprocessor chain in the test
  *
  * @param \Magento\Framework\View\Asset\PreProcessor\Chain $chain
  */
 public function chainTestCallback(\Magento\Framework\View\Asset\PreProcessor\Chain $chain)
 {
     $chain->setContentType('ext');
     $chain->setContent('processed');
 }