예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function getModule()
 {
     return $this->originalAsset->getModule();
 }
예제 #2
0
 /**
  * Build asset key
  *
  * @param LocalInterface $asset
  * @return string
  */
 protected function getAssetKey(LocalInterface $asset)
 {
     $result = ($asset->getModule() == '' ? '' : $asset->getModule() . '/') . $asset->getFilePath();
     $result = $this->minification->addMinifiedSign($result);
     return $result;
 }
예제 #3
0
파일: Source.php 프로젝트: koliaGI/magento2
 /**
  * Find asset file via fallback mechanism
  *
  * @param LocalInterface $asset
  * @param \Magento\Framework\View\Asset\File\FallbackContext $context
  * @return bool|string
  */
 private function findFileThroughFallback(LocalInterface $asset, \Magento\Framework\View\Asset\File\FallbackContext $context)
 {
     $themeModel = $this->themeList->getThemeByFullPath($context->getAreaCode() . '/' . $context->getThemePath());
     $sourceFile = $this->fallback->getFile($context->getAreaCode(), $themeModel, $context->getLocale(), $asset->getFilePath(), $asset->getModule());
     return $sourceFile;
 }
예제 #4
0
 /**
  * Create a file asset similar to an existing local asset by using its context
  *
  * @param string $fileId
  * @param LocalInterface $similarTo
  * @return File
  */
 public function createSimilar($fileId, LocalInterface $similarTo)
 {
     list($module, $filePath) = self::extractModule($fileId);
     if (!$module) {
         $module = $similarTo->getModule();
     }
     return new File($this->assetSource, $similarTo->getContext(), $filePath, $module, $this->assetSource->getContentType($filePath));
 }
예제 #5
0
 /**
  * Create a file asset similar to an existing local asset by using its context
  *
  * @param string $fileId
  * @param LocalInterface $similarTo
  * @return File
  */
 public function createSimilar($fileId, LocalInterface $similarTo)
 {
     list($module, $filePath) = self::extractModule($fileId);
     if (!$module) {
         $module = $similarTo->getModule();
     }
     return $this->fileFactory->create(['source' => $this->assetSource, 'context' => $similarTo->getContext(), 'filePath' => $filePath, 'module' => $module, 'contentType' => $this->assetSource->getContentType($filePath)]);
 }
예제 #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
 /**
  * Compare asset module with excluded module
  *
  * @param array $filePathInfo
  * @param LocalInterface $asset
  * @return bool
  */
 protected function compareModules($filePathInfo, $asset)
 {
     /** @var $asset LocalInterface */
     if (($filePathInfo['excludedModule'] == 'Lib' && $asset->getModule() == '')
         || ($filePathInfo['excludedModule'] == $asset->getModule())
     ) {
         return true;
     }
     return false;
 }
예제 #8
0
 /**
  * Build asset key
  *
  * @param LocalInterface $asset
  * @return string
  */
 protected function getAssetKey(LocalInterface $asset)
 {
     return $asset->getModule() == '' ? $asset->getFilePath() : $asset->getModule() . '/' . $asset->getFilePath();
 }