本文整理匯總了PHP中Magento\Framework\View\Design\ThemeInterface::getFullPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP ThemeInterface::getFullPath方法的具體用法?PHP ThemeInterface::getFullPath怎麽用?PHP ThemeInterface::getFullPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\View\Design\ThemeInterface
的用法示例。
在下文中一共展示了ThemeInterface::getFullPath方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getThemeFilesPath
/**
* Get directory where themes files are stored
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @return string|null
*/
public function getThemeFilesPath(\Magento\Framework\View\Design\ThemeInterface $theme)
{
$path = null;
if ($theme->getFullPath()) {
$path = $this->themeDirectoryRead->getAbsolutePath($theme->getFullPath());
}
return $path;
}
示例2: getThemeFilesPath
/**
* Get directory where themes files are stored
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @return string|null
*/
public function getThemeFilesPath(\Magento\Framework\View\Design\ThemeInterface $theme)
{
$path = null;
if ($theme->getFullPath()) {
$path = $this->componentRegistrar->getPath(ComponentRegistrar::THEME, $theme->getFullPath());
}
return $path;
}
示例3: getFiles
/**
* Retrieve files
*
* @param ThemeInterface $theme
* @param string $filePath
* @return array|\Magento\Framework\View\File[]
* @throws \Magento\Framework\Exception
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$namespace = $module = '*';
$themePath = $theme->getFullPath();
$searchPattern = "{$themePath}/{$namespace}_{$module}/{$this->subDir}*/*/{$filePath}";
$files = $this->themesDirectory->search($searchPattern);
if (empty($files)) {
return [];
}
$themes = [];
$currentTheme = $theme;
while ($currentTheme = $currentTheme->getParentTheme()) {
$themes[$currentTheme->getCode()] = $currentTheme;
}
$result = [];
$pattern = "#/(?<module>[^/]+)/{$this->subDir}(?<themeVendor>[^/]+)/(?<themeName>[^/]+)/" . strtr(preg_quote($filePath), ['\\*' => '[^/]+']) . "\$#i";
foreach ($files as $file) {
$filename = $this->themesDirectory->getAbsolutePath($file);
if (!preg_match($pattern, $filename, $matches)) {
continue;
}
$moduleFull = $matches['module'];
$ancestorThemeCode = $matches['themeVendor'] . '/' . $matches['themeName'];
if (!isset($themes[$ancestorThemeCode])) {
throw new Exception(sprintf("Trying to override modular view file '%s' for theme '%s', which is not ancestor of theme '%s'", $filename, $ancestorThemeCode, $theme->getCode()));
}
$result[] = $this->fileFactory->create($filename, $moduleFull, $themes[$ancestorThemeCode]);
}
return $result;
}
示例4: getFiles
/**
* Retrieve files
*
* @param ThemeInterface $theme
* @param string $filePath
* @return \Magento\Framework\View\File[]
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$namespace = $module = '*';
$themePath = $theme->getFullPath();
if (empty($themePath)) {
return [];
}
$themeAbsolutePath = $this->componentRegistrar->getPath(ComponentRegistrar::THEME, $themePath);
if (!$themeAbsolutePath) {
return [];
}
$themeDir = $this->readDirFactory->create($themeAbsolutePath);
$searchPattern = "{$namespace}_{$module}/{$this->subDir}{$filePath}";
$files = $themeDir->search($searchPattern);
$result = [];
$pattern = "#(?<moduleName>[^/]+)/{$this->subDir}" . $this->pathPatternHelper->translatePatternFromGlob($filePath) . "\$#i";
foreach ($files as $file) {
$filename = $themeDir->getAbsolutePath($file);
if (!preg_match($pattern, $filename, $matches)) {
continue;
}
$result[] = $this->fileFactory->create($filename, $matches['moduleName']);
}
return $result;
}
示例5: getFiles
/**
* Retrieve files
*
* @param ThemeInterface $theme
* @param string $filePath
* @return array|\Magento\Framework\View\File[]
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$themePath = $theme->getFullPath();
$files = $this->themesDirectory->search("{$themePath}/{$this->subDir}{$filePath}");
$result = [];
foreach ($files as $file) {
$filename = $this->themesDirectory->getAbsolutePath($file);
$result[] = $this->fileFactory->create($filename, null, $theme);
}
return $result;
}
示例6: getFiles
/**
* Retrieve files
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param string $filePath
* @return \Magento\Framework\View\File[]
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$namespace = $module = '*';
$themePath = $theme->getFullPath();
$files = $this->directory->search("{$themePath}/{$namespace}_{$module}/{$this->subDir}{$filePath}");
$result = [];
$pattern = "#/(?<moduleName>[^/]+)/{$this->subDir}"
. $this->pathPatternHelper->translatePatternFromGlob($filePath) . "$#i";
foreach ($files as $file) {
$filename = $this->directory->getAbsolutePath($file);
if (!preg_match($pattern, $filename, $matches)) {
continue;
}
$result[] = $this->fileFactory->create($filename, $matches['moduleName'], $theme);
}
return $result;
}
示例7: getFiles
/**
* Retrieve files
*
* @param ThemeInterface $theme
* @param string $filePath
* @return \Magento\Framework\View\File[]
* @throws \UnexpectedValueException
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$themePath = $theme->getFullPath();
if (empty($themePath)) {
return [];
}
$themeAbsolutePath = $this->componentRegistrar->getPath(ComponentRegistrar::THEME, $themePath);
if (!$themeAbsolutePath) {
return [];
}
$themeDir = $this->readDirFactory->create($themeAbsolutePath);
$files = $themeDir->search($this->subDir . $filePath);
$result = [];
foreach ($files as $file) {
$filename = $themeDir->getAbsolutePath($file);
$result[] = $this->fileFactory->create($filename, null, $theme);
}
return $result;
}
示例8: getFiles
/**
* Retrieve files
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param string $filePath
* @return \Magento\Framework\View\File[]
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getFiles(ThemeInterface $theme, $filePath)
{
$namespace = $module = '*';
$themePath = $theme->getFullPath();
$searchPattern = "{$themePath}/{$namespace}_{$module}/{$this->subDir}*/*/{$filePath}";
$files = $this->directory->search($searchPattern);
if (empty($files)) {
return [];
}
$themes = [];
$currentTheme = $theme;
while ($currentTheme = $currentTheme->getParentTheme()) {
$themes[$currentTheme->getCode()] = $currentTheme;
}
$result = [];
$pattern = "#/(?<module>[^/]+)/{$this->subDir}(?<themeVendor>[^/]+)/(?<themeName>[^/]+)/"
. $this->pathPatternHelper->translatePatternFromGlob($filePath) . "$#i";
foreach ($files as $file) {
$filename = $this->directory->getAbsolutePath($file);
if (!preg_match($pattern, $filename, $matches)) {
continue;
}
$moduleFull = $matches['module'];
$ancestorThemeCode = $matches['themeVendor'] . '/' . $matches['themeName'];
if (!isset($themes[$ancestorThemeCode])) {
throw new LocalizedException(
new \Magento\Framework\Phrase(
"Trying to override modular view file '%1' for theme '%2', which is not ancestor of theme '%3'",
[$filename, $ancestorThemeCode, $theme->getCode()]
)
);
}
$result[] = $this->fileFactory->create($filename, $moduleFull, $themes[$ancestorThemeCode]);
}
return $result;
}
示例9: hasTheme
/**
* 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()]);
}