本文整理匯總了PHP中Magento\Framework\View\Design\ThemeInterface::getPreviewImage方法的典型用法代碼示例。如果您正苦於以下問題:PHP ThemeInterface::getPreviewImage方法的具體用法?PHP ThemeInterface::getPreviewImage怎麽用?PHP ThemeInterface::getPreviewImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\View\Design\ThemeInterface
的用法示例。
在下文中一共展示了ThemeInterface::getPreviewImage方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _createStagingTheme
/**
* Create 'staging' theme associated with current 'virtual' theme
*
* @return \Magento\Framework\View\Design\ThemeInterface
*/
protected function _createStagingTheme()
{
$stagingTheme = $this->_themeFactory->create();
$stagingTheme->setData(['parent_id' => $this->_theme->getId(), 'theme_path' => null, 'theme_title' => sprintf('%s - Staging', $this->_theme->getThemeTitle()), 'preview_image' => $this->_theme->getPreviewImage(), 'is_featured' => $this->_theme->getIsFeatured(), 'type' => \Magento\Framework\View\Design\ThemeInterface::TYPE_STAGING]);
$stagingTheme->save();
return $stagingTheme;
}
示例2: getPreviewImagePath
/**
* Get path to preview image
*
* @param ThemeInterface $theme
* @return string
*/
public function getPreviewImagePath(ThemeInterface $theme)
{
return $this->mediaDirectory->getAbsolutePath(self::PREVIEW_DIRECTORY_PATH . '/' . $theme->getPreviewImage());
}
示例3: _savePreviewImage
/**
* Save preview image for theme
*
* @param ThemeInterface $theme
* @return $this
*/
protected function _savePreviewImage(ThemeInterface $theme)
{
$themeDirectory = $theme->getCustomization()->getThemeFilesPath();
if (!$theme->getPreviewImage() || !$themeDirectory) {
return $this;
}
$imagePath = $themeDirectory . '/' . $theme->getPreviewImage();
if (0 === strpos($imagePath, $themeDirectory)) {
$theme->getThemeImage()->createPreviewImage($imagePath);
}
return $this;
}
示例4: getPreviewImageUrl
/**
* Get url of theme preview image
*
* @return string
*/
public function getPreviewImageUrl()
{
$previewImage = $this->theme->getPreviewImage();
return empty($previewImage) ? $this->themeImagePath->getPreviewImageDefaultUrl() : $this->themeImagePath->getPreviewImageUrl($this->theme);
}
示例5: getPreviewImagePath
/**
* Get path to preview image
*
* @param \Magento\Core\Model\Theme|ThemeInterface $theme
* @return string
*/
public function getPreviewImagePath(ThemeInterface $theme)
{
return $theme->isPhysical() ? $this->assetRepo->createAsset($theme->getPreviewImage(), ['area' => $theme->getData('area'), 'themeModel' => $theme])->getSourceFile() : $this->mediaDirectory->getAbsolutePath(self::PREVIEW_DIRECTORY_PATH . '/' . $theme->getPreviewImage());
}