Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function resolve($type, $file, $area = null, ThemeInterface $theme = null, $locale = null, $module = null)
 {
     self::assertFilePathFormat($file);
     $themePath = $theme ? $theme->getThemePath() : '';
     $path = $this->cache->getFromCache($type, $file, $area, $themePath, $locale, $module);
     if (false !== $path) {
         $path = $path ? $this->rootDirectory->getAbsolutePath($path) : false;
     } else {
         $params = ['area' => $area, 'theme' => $theme, 'locale' => $locale];
         foreach ($params as $key => $param) {
             if ($param === null) {
                 unset($params[$key]);
             }
         }
         if (!empty($module)) {
             list($params['namespace'], $params['module']) = explode('_', $module, 2);
         }
         $path = $this->resolveFile($this->rulePool->getRule($type), $file, $params);
         $cachedValue = $path ? $this->rootDirectory->getRelativePath($path) : '';
         $this->cache->saveToCache($cachedValue, $type, $file, $area, $themePath, $locale, $module);
     }
     return $path;
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function setTheme(\Magento\Framework\View\Design\ThemeInterface $theme)
 {
     $this->_theme = $theme;
     $this->setData('theme_id', $theme->getId());
     $this->setData('theme_path', $theme->getThemePath());
     return $this;
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function getThemePath(\Magento\Framework\View\Design\ThemeInterface $theme)
 {
     $themePath = $theme->getThemePath();
     if (!$themePath) {
         $themeId = $theme->getId();
         if ($themeId) {
             $themePath = self::PUBLIC_THEME_DIR . $themeId;
         } else {
             $themePath = self::PUBLIC_VIEW_DIR;
         }
     }
     return $themePath;
 }
Пример #4
0
 /**
  * Checks that a theme present in filesystem collection
  *
  * @param ThemeInterface $theme
  * @return bool
  */
 public function hasTheme(ThemeInterface $theme)
 {
     $themeItems = $this->getItems();
     return $theme->getThemePath() && isset($themeItems[$theme->getFullPath()]);
 }