本文整理匯總了PHP中Magento\Framework\View\Design\ThemeInterface::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP ThemeInterface::getId方法的具體用法?PHP ThemeInterface::getId怎麽用?PHP ThemeInterface::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\View\Design\ThemeInterface
的用法示例。
在下文中一共展示了ThemeInterface::getId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: assignToStore
/**
* Assign theme to the stores
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param array $stores
* @param string $scope
* @return $this
*/
public function assignToStore($theme, array $stores = [], $scope = \Magento\Store\Model\ScopeInterface::SCOPE_STORES)
{
$isReassigned = false;
$this->_unassignThemeFromStores($theme->getId(), $stores, $scope, $isReassigned);
if ($this->_storeManager->isSingleStoreMode()) {
$this->_assignThemeToDefaultScope($theme->getId(), $isReassigned);
} else {
$this->_assignThemeToStores($theme->getId(), $stores, $scope, $isReassigned);
}
if ($isReassigned) {
$this->_configCache->clean();
$this->_layoutCache->clean();
}
$this->_eventManager->dispatch('assign_theme_to_stores_after', ['stores' => $stores, 'scope' => $scope, 'theme' => $theme]);
return $this;
}
示例3: fetchUpdatesByHandle
/**
* Retrieve layout updates by handle
*
* @param string $handle
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param \Magento\Framework\App\ScopeInterface $store
* @return string
*/
public function fetchUpdatesByHandle($handle, \Magento\Framework\View\Design\ThemeInterface $theme, \Magento\Framework\App\ScopeInterface $store)
{
$bind = ['layout_update_handle' => $handle, 'theme_id' => $theme->getId(), 'store_id' => $store->getId()];
$result = '';
$connection = $this->getConnection();
if ($connection) {
$select = $this->_getFetchUpdatesByHandleSelect();
$result = join('', $connection->fetchCol($select, $bind));
}
return $result;
}
示例4: fetchUpdatesByHandle
/**
* Retrieve layout updates by handle
*
* @param string $handle
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param \Magento\Framework\App\ScopeInterface $store
* @return string
*/
public function fetchUpdatesByHandle($handle, \Magento\Framework\View\Design\ThemeInterface $theme, \Magento\Framework\App\ScopeInterface $store)
{
$bind = ['theme_id' => $theme->getId(), 'store_id' => $store->getId()];
$cacheKey = implode('-', $bind);
if (!isset($this->layoutUpdateCache[$cacheKey])) {
$this->layoutUpdateCache[$cacheKey] = [];
foreach ($this->getConnection()->fetchAll($this->_getFetchUpdatesByHandleSelect(), $bind) as $layout) {
if (!isset($this->layoutUpdateCache[$cacheKey][$layout['handle']])) {
$this->layoutUpdateCache[$cacheKey][$layout['handle']] = '';
}
$this->layoutUpdateCache[$cacheKey][$layout['handle']] .= $layout['xml'];
}
}
return isset($this->layoutUpdateCache[$cacheKey][$handle]) ? $this->layoutUpdateCache[$cacheKey][$handle] : '';
}
示例5: _configureToolbarBlocks
/**
* Pass data to the Toolbar panel blocks that is needed for rendering
*
* @param ThemeInterface $theme
* @param ThemeInterface $editableTheme
* @param string $mode
* @return $this
*/
protected function _configureToolbarBlocks($theme, $editableTheme, $mode)
{
/** @var $toolbarBlock \Magento\DesignEditor\Block\Adminhtml\Editor\Toolbar\Buttons */
$toolbarBlock = $this->_view->getLayout()->getBlock('design_editor_toolbar_buttons');
$toolbarBlock->setThemeId($editableTheme->getId())->setVirtualThemeId($theme->getId())->setMode($mode);
/** @var $saveButtonBlock \Magento\DesignEditor\Block\Adminhtml\Editor\Toolbar\Buttons\Save */
$saveButtonBlock = $this->_view->getLayout()->getBlock('design_editor_toolbar_buttons_save');
if ($saveButtonBlock) {
$saveButtonBlock->setTheme($theme)->setMode($mode)->setHasThemeAssigned($this->_customizationConfig->hasThemeAssigned());
}
/** @var $saveButtonBlock \Magento\DesignEditor\Block\Adminhtml\Editor\Toolbar\Buttons\Edit */
$editButtonBlock = $this->_view->getLayout()->getBlock('design_editor_toolbar_buttons_edit');
if ($editButtonBlock) {
$editButtonBlock->setTheme($editableTheme);
}
return $this;
}
示例6: _getVirtualThemeTitle
/**
* Get virtual theme title
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @return string
*/
protected function _getVirtualThemeTitle($theme)
{
$themeCopyCount = $this->_themeCollection->addAreaFilter(\Magento\Framework\App\Area::AREA_FRONTEND)->addTypeFilter(\Magento\Framework\View\Design\ThemeInterface::TYPE_VIRTUAL)->addFilter('parent_id', $theme->getId())->count();
$title = sprintf("%s - %s #%s", $theme->getThemeTitle(), __('Copy'), $themeCopyCount + 1);
return $title;
}
示例7: updateChildRelations
/**
* Update all child themes relations
*
* @param \Magento\Framework\View\Design\ThemeInterface $themeModel
* @return $this
*/
public function updateChildRelations(\Magento\Framework\View\Design\ThemeInterface $themeModel)
{
$parentThemeId = $themeModel->getParentId();
$this->addFieldToFilter('parent_id', ['eq' => $themeModel->getId()])->load();
/** @var $theme \Magento\Framework\View\Design\ThemeInterface */
foreach ($this->getItems() as $theme) {
$theme->setParentId($parentThemeId)->save();
}
return $this;
}
示例8: getCustomViewConfigPath
/**
* Get path to custom view configuration file
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @return string|null
*/
public function getCustomViewConfigPath(\Magento\Framework\View\Design\ThemeInterface $theme)
{
$path = null;
if ($theme->getId()) {
$path = $this->mediaDirectoryRead->getAbsolutePath(self::DIR_NAME . '/' . $theme->getId() . '/' . $this->filename);
}
return $path;
}
示例9: _isThemeAssignedToSpecificStore
/**
* Is theme assigned to specific store
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @param \Magento\Store\Model\Store $store
* @return bool
*/
protected function _isThemeAssignedToSpecificStore($theme, $store)
{
return $theme->getId() == $this->_getConfigurationThemeId($store);
}
示例10: _hasThemeChanged
/**
* Checks themes for changes by time
*
* @param \Magento\Framework\View\Design\ThemeInterface $sourceTheme
* @param \Magento\Framework\View\Design\ThemeInterface $targetTheme
* @return bool
*/
protected function _hasThemeChanged(\Magento\Framework\View\Design\ThemeInterface $sourceTheme, \Magento\Framework\View\Design\ThemeInterface $targetTheme)
{
$sourceChange = $this->_changeFactory->create();
$sourceChange->loadByThemeId($sourceTheme->getId());
$targetChange = $this->_changeFactory->create();
$targetChange->loadByThemeId($targetTheme->getId());
return $sourceChange->getChangeTime() !== $targetChange->getChangeTime();
}
示例11: addThemeFilter
/**
* Filter out files that do not belong to a theme
*
* @param \Magento\Framework\View\Design\ThemeInterface $theme
* @return $this
*/
public function addThemeFilter(\Magento\Framework\View\Design\ThemeInterface $theme)
{
$this->addFieldToFilter('theme_id', $theme->getId());
return $this;
}
示例12: _copyLayoutCustomization
/**
* Add layout links to general layout updates for themes
*
* @param ThemeInterface $source
* @param ThemeInterface $target
* @return void
*/
protected function _copyLayoutCustomization(ThemeInterface $source, ThemeInterface $target)
{
$update = $this->_updateFactory->create();
/** @var $targetUpdates \Magento\Widget\Model\Resource\Layout\Update\Collection */
$targetUpdates = $update->getCollection();
$targetUpdates->addThemeFilter($target->getId());
$targetUpdates->delete();
/** @var $sourceCollection \Magento\Widget\Model\Resource\Layout\Link\Collection */
$sourceCollection = $this->_link->getCollection();
$sourceCollection->addThemeFilter($source->getId());
/** @var $layoutLink \Magento\Widget\Model\Layout\Link */
foreach ($sourceCollection as $layoutLink) {
/** @var $update \Magento\Widget\Model\Layout\Update */
$update = $this->_updateFactory->create();
$update->load($layoutLink->getLayoutUpdateId());
if ($update->getId()) {
$update->setId(null);
$update->save();
$layoutLink->setThemeId($target->getId());
$layoutLink->setLayoutUpdateId($update->getId());
$layoutLink->setId(null);
$layoutLink->save();
}
}
}
示例13: generateCacheId
/**
* Generate cache identifier taking into account current area/package/theme/store
*
* @param string $suffix
* @return string
*/
protected function generateCacheId($suffix = '')
{
return "LAYOUT_{$this->theme->getArea()}_STORE{$this->scope->getId()}_{$this->theme->getId()}{$suffix}";
}
示例14: getThemePath
/**
* {@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;
}
示例15: setTheme
/**
* {@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;
}