本文整理匯總了PHP中Magento\Store\Model\StoreManagerInterface::isSingleStoreMode方法的典型用法代碼示例。如果您正苦於以下問題:PHP StoreManagerInterface::isSingleStoreMode方法的具體用法?PHP StoreManagerInterface::isSingleStoreMode怎麽用?PHP StoreManagerInterface::isSingleStoreMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Store\Model\StoreManagerInterface
的用法示例。
在下文中一共展示了StoreManagerInterface::isSingleStoreMode方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: prepare
/**
* Prepare component configuration
*
* @return void
*/
public function prepare()
{
parent::prepare();
if ($this->storeManager->isSingleStoreMode()) {
$this->_data['config']['componentDisabled'] = true;
}
}
示例2: getData
/**
* Retrieve configuration metadata
*
* @return array
*/
public function getData()
{
$scope = $this->request->getParam('scope');
$scopeId = $this->request->getParam('scope_id');
$data = [];
if ($scope) {
$showFallbackReset = false;
list($fallbackScope, $fallbackScopeId) = $this->scopeFallbackResolver->getFallbackScope($scope, $scopeId);
if ($fallbackScope && !$this->storeManager->isSingleStoreMode()) {
$scope = $fallbackScope;
$scopeId = $fallbackScopeId;
$showFallbackReset = true;
}
$designConfig = $this->designConfigRepository->getByScope($scope, $scopeId);
$fieldsData = $designConfig->getExtensionAttributes()->getDesignConfigData();
foreach ($fieldsData as $fieldData) {
$element =& $data;
foreach (explode('/', $fieldData->getFieldConfig()['fieldset']) as $fieldset) {
if (!isset($element[$fieldset]['children'])) {
$element[$fieldset]['children'] = [];
}
$element =& $element[$fieldset]['children'];
}
$fieldName = $fieldData->getFieldConfig()['field'];
$element[$fieldName]['arguments']['data']['config']['default'] = $fieldData->getValue();
$element[$fieldName]['arguments']['data']['config']['showFallbackReset'] = $showFallbackReset;
}
}
return $data;
}
示例3: setStoreIds
/**
* Set store ids to run the upgrade on
*
* @return $this
*/
public function setStoreIds(array $ids)
{
if ($this->storeManager->isSingleStoreMode()) {
$ids = [\Magento\Store\Model\Store::DEFAULT_STORE_ID];
}
$this->storeIds = $ids;
return $this;
}
示例4: _prepareColumns
/**
* {@inheritdoc}
*/
protected function _prepareColumns()
{
$this->addColumn('term', ['header' => __('Stopword'), 'type' => 'text', 'index' => 'term']);
if (!$this->storeManager->isSingleStoreMode()) {
$this->addColumn('store_id', ['header' => __('Store'), 'type' => 'store', 'index' => 'store_id']);
}
return parent::_prepareColumns();
}
示例5: modifyMeta
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function modifyMeta(array $meta)
{
$samplesPath = Composite::CHILDREN_PATH . '/' . Composite::CONTAINER_SAMPLES;
$samplesContainer['arguments']['data']['config'] = ['additionalClasses' => 'admin__fieldset-section', 'componentType' => Form\Fieldset::NAME, 'label' => __('Samples'), 'dataScope' => '', 'visible' => $this->locator->getProduct()->getTypeId() === Type::TYPE_DOWNLOADABLE, 'sortOrder' => 40];
$samplesTitle['arguments']['data']['config'] = ['componentType' => Form\Field::NAME, 'formElement' => Form\Element\Input::NAME, 'dataType' => Form\Element\DataType\Text::NAME, 'label' => __('Title'), 'dataScope' => 'product.samples_title', 'scopeLabel' => $this->storeManager->isSingleStoreMode() ? '' : '[STORE VIEW]'];
// @codingStandardsIgnoreStart
$informationSamples['arguments']['data']['config'] = ['componentType' => Container::NAME, 'component' => 'Magento_Ui/js/form/components/html', 'additionalClasses' => 'admin__fieldset-note', 'content' => __('Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.')];
// @codingStandardsIgnoreEnd
$samplesContainer = $this->arrayManager->set('children', $samplesContainer, ['samples_title' => $samplesTitle, 'sample' => $this->getDynamicRows(), 'information_samples' => $informationSamples]);
return $this->arrayManager->set($samplesPath, $meta, $samplesContainer);
}
示例6: isVisible
/**
* Check a configuration element visibility
*
* @param \Magento\Config\Model\Config\Structure\AbstractElement $element The config composite element
* @param string $scope The element scope
*
* @return bool
*/
public function isVisible(\Magento\Config\Model\Config\Structure\AbstractElement $element, $scope)
{
if ($element->getAttribute('if_module_enabled') && !$this->moduleManager->isOutputEnabled($element->getAttribute('if_module_enabled'))) {
return false;
}
$showInScope = [ContainerScopeInterface::SCOPE_DEFAULT => $element->getAttribute('showInDefault'), ContainerScopeInterface::SCOPE_CONTAINERS => $element->getAttribute('showInContainer'), ContainerScopeInterface::SCOPE_STORE_CONTAINERS => $element->getAttribute('showInStore')];
if ($this->storeManager->isSingleStoreMode()) {
$result = !$element->getAttribute('hide_in_single_store_mode') && array_sum($showInScope);
return $result;
}
return !empty($showInScope[$scope]);
}
示例7: getData
/**
* Get data
*
* @return array
*/
public function getData()
{
if ($this->storeManager->isSingleStoreMode()) {
$websites = $this->storeManager->getWebsites();
$singleStoreWebsite = array_shift($websites);
$this->addFilter($this->filterBuilder->setField('store_website_id')->setValue($singleStoreWebsite->getId())->create());
$this->addFilter($this->filterBuilder->setField('store_group_id')->setConditionType('null')->create());
}
$data = parent::getData();
foreach ($data['items'] as &$item) {
$item += ['default' => __('Global')];
}
return $data;
}
示例8: 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;
}
示例9: modifyMeta
/**
* {@inheritdoc}
*/
public function modifyMeta(array $meta)
{
if (!$this->storeManager->isSingleStoreMode()) {
$meta = array_replace_recursive($meta, ['websites' => ['arguments' => ['data' => ['config' => ['additionalClasses' => 'admin__fieldset-product-websites', 'label' => __('Product in Websites'), 'collapsible' => true, 'componentType' => Form\Fieldset::NAME, 'dataScope' => self::DATA_SCOPE_PRODUCT, 'sortOrder' => $this->getNextGroupSortOrder($meta, 'search-engine-optimization', self::SORT_ORDER)]]], 'children' => $this->getFieldsForFieldset()]]);
}
return $meta;
}
示例10: _prepareForm
/**
* {@inheritdoc}
*/
protected function _prepareForm()
{
$form = $this->_formFactory->create(['data' => ['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']]);
$fieldset = $form->addFieldset('base_fieldset', []);
$fieldset->addField('file', 'select', ['name' => 'file', 'label' => __('Dictionary'), 'required' => true, 'values' => $this->getFiles()]);
if (!$this->storeManager->isSingleStoreMode()) {
$field = $fieldset->addField('store_id', 'select', ['label' => __('Store'), 'title' => __('Store'), 'values' => $this->systemStore->getStoreValuesForForm(), 'name' => 'store_id', 'required' => true]);
$renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
$field->setRenderer($renderer);
} else {
$fieldset->addField('store_id', 'hidden', ['name' => 'store_id', 'value' => $this->storeManager->getStore(true)->getId()]);
}
$form->setAction($this->getUrl('*/*/doImport'));
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例11: isVisible
/**
* Check whether element should be displayed
*
* @return bool
*/
public function isVisible()
{
$showInScope = [\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]);
}
示例12: getSelectedStore
/**
* Returns the currently selected store.
* If it is single store setup, then just return the default store.
* If it is a multi store setup, the expect a store id to passed in the
* request params and return that store as the current one.
*
* @return Store|null the store or null if not found.
*/
protected function getSelectedStore()
{
if ($this->_storeManager->isSingleStoreMode()) {
return $this->_storeManager->getStore(true);
} elseif ($storeId = $this->_storeManager->getStore()->getId()) {
return $this->_storeManager->getStore($storeId);
} else {
return null;
}
}
示例13: 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;
}
示例14: getCorrectScope
/**
* Retrieve correct scope corresponding single store mode configuration
*
* @param string $scope
* @param string $scopeId
* @return array
*/
protected function getCorrectScope($scope, $scopeId)
{
$isSingleStoreMode = $this->storeManager->isSingleStoreMode();
if ($isSingleStoreMode) {
$websites = $this->storeManager->getWebsites();
$singleStoreWebsite = array_shift($websites);
$scope = ScopeInterface::SCOPE_WEBSITES;
$scopeId = $singleStoreWebsite->getId();
}
return ['scope' => $scope, 'scopeId' => $scopeId];
}
示例15: modifyMeta
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function modifyMeta(array $meta)
{
$linksPath = Composite::CHILDREN_PATH . '/' . Composite::CONTAINER_LINKS;
$linksContainer['arguments']['data']['config'] = ['componentType' => Form\Fieldset::NAME, 'additionalClasses' => 'admin__fieldset-section', 'label' => __('Links'), 'dataScope' => '', 'visible' => $this->locator->getProduct()->getTypeId() === Type::TYPE_DOWNLOADABLE, 'sortOrder' => 30];
$linksTitle['arguments']['data']['config'] = ['componentType' => Form\Field::NAME, 'formElement' => Form\Element\Input::NAME, 'dataType' => Form\Element\DataType\Text::NAME, 'label' => __('Title'), 'dataScope' => 'product.links_title', 'scopeLabel' => $this->storeManager->isSingleStoreMode() ? '' : '[STORE VIEW]'];
$linksPurchasedSeparately['arguments']['data']['config'] = ['componentType' => Form\Field::NAME, 'formElement' => Form\Element\Checkbox::NAME, 'dataType' => Form\Element\DataType\Number::NAME, 'description' => __('Links can be purchased separately'), 'label' => ' ', 'dataScope' => 'product.links_purchased_separately', 'scopeLabel' => $this->storeManager->isSingleStoreMode() ? '' : '[GLOBAL]', 'valueMap' => ['false' => '0', 'true' => '1']];
// @codingStandardsIgnoreStart
$informationLinks['arguments']['data']['config'] = ['componentType' => Container::NAME, 'component' => 'Magento_Ui/js/form/components/html', 'additionalClasses' => 'admin__fieldset-note', 'content' => __('Alphanumeric, dash and underscore characters are recommended for filenames. Improper characters are replaced with \'_\'.')];
// @codingStandardsIgnoreEnd
$linksContainer = $this->arrayManager->set('children', $linksContainer, ['links_title' => $linksTitle, 'links_purchased_separately' => $linksPurchasedSeparately, 'link' => $this->getDynamicRows(), 'information_links' => $informationLinks]);
return $this->arrayManager->set($linksPath, $meta, $linksContainer);
}