当前位置: 首页>>代码示例>>PHP>>正文


PHP StoreManagerInterface::isSingleStoreMode方法代码示例

本文整理汇总了PHP中Magento\Framework\StoreManagerInterface::isSingleStoreMode方法的典型用法代码示例。如果您正苦于以下问题:PHP StoreManagerInterface::isSingleStoreMode方法的具体用法?PHP StoreManagerInterface::isSingleStoreMode怎么用?PHP StoreManagerInterface::isSingleStoreMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\StoreManagerInterface的用法示例。


在下文中一共展示了StoreManagerInterface::isSingleStoreMode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isVisible

 /**
  * Check whether element should be displayed
  *
  * @return bool
  */
 public function isVisible()
 {
     $showInScope = array(\Magento\Store\Model\ScopeInterface::SCOPE_STORE => $this->_hasVisibilityValue('showInStore'), \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE => $this->_hasVisibilityValue('showInWebsite'), \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT => $this->_hasVisibilityValue('showInDefault'));
     if ($this->_storeManager->isSingleStoreMode()) {
         $result = !$this->_hasVisibilityValue('hide_in_single_store_mode') && array_sum($showInScope);
         return $result;
     }
     return !empty($showInScope[$this->_scope]);
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:14,代码来源:AbstractElement.php

示例2: addStoreData

 /**
  * Add stores data to collection
  *
  * @return $this
  */
 public function addStoreData()
 {
     if (!$this->_storeManager->isSingleStoreMode()) {
         if (!$this->_isCollectionLoaded) {
             $this->_addStoreDataFlag = true;
         } elseif (!$this->_addStoreDataFlag) {
             $this->_addStoreData();
         }
     }
     return $this;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:16,代码来源:Collection.php

示例3: getScopeLabel

 /**
  * Retrieve label of attribute scope
  *
  * GLOBAL | WEBSITE | STORE
  *
  * @param Attribute $attribute
  * @return string
  */
 public function getScopeLabel($attribute)
 {
     $html = '';
     if ($this->_storeManager->isSingleStoreMode()) {
         return $html;
     }
     if ($attribute->isScopeGlobal()) {
         $html .= '<br/>' . __('[GLOBAL]');
     } elseif ($attribute->isScopeWebsite()) {
         $html .= '<br/>' . __('[WEBSITE]');
     } elseif ($attribute->isScopeStore()) {
         $html .= '<br/>' . __('[STORE VIEW]');
     }
     return $html;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:23,代码来源:Gallery.php

示例4: _checkSingleStoreMode

 /**
  * Set correct scope if isSingleStoreMode = true
  *
  * @param \Magento\Backend\Model\Config\Structure\Element\Field $fieldConfig
  * @param \Magento\Framework\App\Config\ValueInterface $dataObject
  * @return void
  */
 protected function _checkSingleStoreMode(\Magento\Backend\Model\Config\Structure\Element\Field $fieldConfig, $dataObject)
 {
     $isSingleStoreMode = $this->_storeManager->isSingleStoreMode();
     if (!$isSingleStoreMode) {
         return;
     }
     if (!$fieldConfig->showInDefault()) {
         $websites = $this->_storeManager->getWebsites();
         $singleStoreWebsite = array_shift($websites);
         $dataObject->setScope('websites');
         $dataObject->setWebsiteCode($singleStoreWebsite->getCode());
         $dataObject->setScopeCode($singleStoreWebsite->getCode());
         $dataObject->setScopeId($singleStoreWebsite->getId());
     }
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:22,代码来源:Config.php

示例5: 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 = array(), $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', array('stores' => $stores, 'scope' => $scope, 'theme' => $theme));
     return $this;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:24,代码来源:Config.php

示例6: addRatingInfo

 /**
  * Add rating info to select
  *
  * @param int $storeId
  * @return $this
  */
 public function addRatingInfo($storeId = null)
 {
     $adapter = $this->getConnection();
     $ratingCodeCond = $adapter->getIfNullSql('title.value', 'rating.rating_code');
     $this->getSelect()->join(array('rating' => $this->getTable('rating')), 'rating.rating_id = main_table.rating_id', array('rating_code'))->joinLeft(array('title' => $this->getTable('rating_title')), $adapter->quoteInto('main_table.rating_id=title.rating_id AND title.store_id = ?', (int) $this->_storeManager->getStore()->getId()), array('rating_code' => $ratingCodeCond));
     if (!$this->_storeManager->isSingleStoreMode()) {
         if ($storeId == null) {
             $storeId = $this->_storeManager->getStore()->getId();
         }
         if (is_array($storeId)) {
             $condition = $adapter->prepareSqlCondition('store.store_id', array('in' => $storeId));
         } else {
             $condition = $adapter->quoteInto('store.store_id = ?', $storeId);
         }
         $this->getSelect()->join(array('store' => $this->getTable('rating_store')), 'main_table.rating_id = store.rating_id AND ' . $condition);
     }
     $adapter->fetchAll($this->getSelect());
     return $this;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:25,代码来源:Collection.php

示例7: getConfigurationDesignTheme

 /**
  * Get default theme which declared in configuration
  *
  * Write default theme to core_config_data
  *
  * @param string|null $area
  * @param array $params
  * @return string|int
  */
 public function getConfigurationDesignTheme($area = null, array $params = array())
 {
     if (!$area) {
         $area = $this->getArea();
     }
     $theme = null;
     $store = isset($params['store']) ? $params['store'] : null;
     if ($this->_isThemePerStoveView($area)) {
         if ($this->_storeManager->isSingleStoreMode()) {
             $theme = $this->_scopeConfig->getValue(self::XML_PATH_THEME_ID, \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT);
         } else {
             $theme = (string) $this->_scopeConfig->getValue(self::XML_PATH_THEME_ID, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store);
         }
     }
     if (!$theme && isset($this->_themes[$area])) {
         $theme = $this->_themes[$area];
     }
     return $theme;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:28,代码来源:Design.php

示例8: getReviewSummary

 /**
  * Review summary
  *
  * @param \Magento\Review\Model\Rating $object
  * @param boolean $onlyForCurrentStore
  * @return array
  */
 public function getReviewSummary($object, $onlyForCurrentStore = true)
 {
     $adapter = $this->_getReadAdapter();
     $sumColumn = new \Zend_Db_Expr("SUM(rating_vote.{$adapter->quoteIdentifier('percent')})");
     $countColumn = new \Zend_Db_Expr('COUNT(*)');
     $select = $adapter->select()->from(array('rating_vote' => $this->getTable('rating_option_vote')), array('sum' => $sumColumn, 'count' => $countColumn))->joinLeft(array('review_store' => $this->getTable('review_store')), 'rating_vote.review_id = review_store.review_id', array('review_store.store_id'));
     if (!$this->_storeManager->isSingleStoreMode()) {
         $select->join(array('rating_store' => $this->getTable('rating_store')), 'rating_store.rating_id = rating_vote.rating_id AND rating_store.store_id = review_store.store_id', array());
     }
     $select->where('rating_vote.review_id = :review_id')->group('rating_vote.review_id')->group('review_store.store_id');
     $data = $adapter->fetchAll($select, array(':review_id' => $object->getReviewId()));
     if ($onlyForCurrentStore) {
         foreach ($data as $row) {
             if ($row['store_id'] == $this->_storeManager->getStore()->getId()) {
                 $object->addData($row);
             }
         }
         return $object;
     }
     $result = array();
     $stores = $this->_storeManager->getStore()->getResourceCollection()->load();
     foreach ($data as $row) {
         $clone = clone $object;
         $clone->addData($row);
         $result[$clone->getStoreId()] = $clone;
     }
     $usedStoresId = array_keys($result);
     foreach ($stores as $store) {
         if (!in_array($store->getId(), $usedStoresId)) {
             $clone = clone $object;
             $clone->setCount(0);
             $clone->setSum(0);
             $clone->setStoreId($store->getId());
             $result[$store->getId()] = $clone;
         }
     }
     return array_values($result);
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:45,代码来源:Rating.php

示例9: isSingleStoreMode

 /**
  * Check if Single Store Mode is enabled
  *
  * @return bool
  */
 public function isSingleStoreMode()
 {
     return $this->_storeManager->isSingleStoreMode();
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:9,代码来源:Sendemail.php


注:本文中的Magento\Framework\StoreManagerInterface::isSingleStoreMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。