예제 #1
0
 /**
  * @param \Magento\Framework\View\Asset\LocalInterface $asset
  * @param string $origContent
  * @param string $origContentType
  */
 public function __construct(\Magento\Framework\View\Asset\LocalInterface $asset, $origContent, $origContentType)
 {
     $this->asset = $asset;
     $this->origContent = $origContent;
     $this->content = $origContent;
     $this->origContentType = $origContentType;
     $this->contentType = $origContentType;
     $this->targetContentType = $asset->getContentType();
 }
예제 #2
0
 /**
  * @param LocalInterface $asset
  * @param string $origContent
  * @param string $origContentType
  */
 public function __construct(LocalInterface $asset, $origContent, $origContentType)
 {
     $this->asset = $asset;
     $this->origContent = $origContent;
     $this->content = $origContent;
     $this->origContentType = $origContentType;
     $this->contentType = $origContentType;
     $this->targetContentType = $asset->getContentType();
     $this->targetAssetPath = $asset->getPath();
 }
예제 #3
0
 /**
  * Process the resulting asset after merging content is done
  *
  * @param Asset\LocalInterface $result
  * @param string $content
  * @return string
  */
 private function preProcessMergeResult(Asset\LocalInterface $result, $content)
 {
     if ($result->getContentType() == 'css') {
         $content = $this->cssUrlResolver->aggregateImportDirectives($content);
     }
     return $content;
 }
예제 #4
0
 /**
  * {@inheritdoc}
  */
 public function getContentType()
 {
     return $this->originalAsset->getContentType();
 }
예제 #5
0
파일: Source.php 프로젝트: koliaGI/magento2
 /**
  * Creates a chain for pre-processing
  *
  * @param LocalInterface $asset
  * @param string|bool $dir
  * @param string|bool $path
  * @return PreProcessor\Chain
  */
 private function createChain(LocalInterface $asset, $dir, $path)
 {
     if ($path) {
         $origContent = $this->readFactory->create($dir)->readFile($path);
         $origContentType = $this->getContentType($path);
     } else {
         $origContent = '';
         $origContentType = $asset->getContentType();
     }
     $chain = $this->chainFactory->create(['asset' => $asset, 'origContent' => $origContent, 'origContentType' => $origContentType, 'origAssetPath' => $dir . '/' . $path]);
     return $chain;
 }
예제 #6
0
 /**
  * @param LocalInterface $asset
  * @return bool
  */
 protected function isValidType(LocalInterface $asset)
 {
     $type = $asset->getContentType();
     if (!in_array($type, self::$availableTypes)) {
         return false;
     }
     if ($type == self::ASSET_TYPE_HTML) {
         return $asset->getModule() !== '';
     }
     return true;
 }
예제 #7
0
    /**
     * @param LocalInterface $asset
     * @return bool
     */
    protected function isValidType(LocalInterface $asset)
    {
        $type = $asset->getContentType();
        if (!in_array($type, self::$availableTypes)) {
            return false;
        }

        return true;
    }