/** * @param string $baseUrl * @param string $areaType * @param string $themePath * @param string $localeCode * @param bool $isSecure */ public function __construct($baseUrl, $areaType, $themePath, $localeCode, $isSecure = false) { $this->area = $areaType; $this->theme = $themePath; $this->locale = $localeCode; $this->isSecure = $isSecure; parent::__construct($baseUrl, DirectoryList::STATIC_VIEW, $this->generatePath()); }
/** * Generate minified file and fill the properties to reference that file * * @return void */ protected function fillPropertiesByMinifyingAsset() { $path = $this->originalAsset->getPath(); $this->context = new \Magento\Framework\View\Asset\File\Context($this->baseUrl->getBaseUrl(['_type' => \Magento\Framework\UrlInterface::URL_TYPE_STATIC]), DirectoryList::STATIC_VIEW, self::CACHE_VIEW_REL . '/minified'); $this->filePath = md5($path) . '_' . $this->composeMinifiedName(basename($path)); $this->path = $this->context->getPath() . '/' . $this->filePath; $this->minify(); $this->file = $this->staticViewDir->getAbsolutePath($this->path); $this->url = $this->context->getBaseUrl() . $this->path; }
/** * Find asset file by simply appending its path to the directory in context * * @param LocalInterface $asset * @param \Magento\Framework\View\Asset\File\Context $context * @return string */ private function findFile(LocalInterface $asset, \Magento\Framework\View\Asset\File\Context $context) { $dir = $this->filesystem->getDirectoryRead($context->getBaseDirType()); Simple::assertFilePathFormat($asset->getFilePath()); return $dir->getAbsolutePath($asset->getPath()); }