/** * @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(); }
/** * @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(); }
/** * 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; }
/** * {@inheritdoc} */ public function getContentType() { return $this->originalAsset->getContentType(); }
/** * 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; }
/** * @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; }
/** * @param LocalInterface $asset * @return bool */ protected function isValidType(LocalInterface $asset) { $type = $asset->getContentType(); if (!in_array($type, self::$availableTypes)) { return false; } return true; }