/** * {@inheritdoc} */ public function getModule() { return $this->originalAsset->getModule(); }
/** * 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; }
/** * 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; }
/** * 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)); }
/** * 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)]); }
/** * @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; }
/** * 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; }
/** * Build asset key * * @param LocalInterface $asset * @return string */ protected function getAssetKey(LocalInterface $asset) { return $asset->getModule() == '' ? $asset->getFilePath() : $asset->getModule() . '/' . $asset->getFilePath(); }