Skip to content

Commit 59392bf

Browse files
ENGCOM-5762: Resolve 'New Block' form still show 'Store View' field in 'Single Store Mode' issue24387 #24397
- Merge Pull Request #24397 from edenduong/magento2:2.3-bugfix/single_store_mode_cms_issue24387 - Merged commits: 1. 24c022e 2. aaa7379
2 parents db43c11 + aaa7379 commit 59392bf

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
<dataScope>identifier</dataScope>
112112
</settings>
113113
</field>
114-
<field name="storeviews" formElement="multiselect">
114+
<field name="storeviews" formElement="multiselect" class="Magento\Store\Ui\Component\Form\Field\StoreView">
115115
<argument name="data" xsi:type="array">
116116
<item name="config" xsi:type="array">
117117
<item name="source" xsi:type="string">block</item>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Store\Ui\Component\Form\Field;
9+
10+
use Magento\Framework\View\Element\UiComponent\ContextInterface;
11+
use Magento\Framework\View\Element\UiComponentFactory;
12+
use Magento\Store\Model\StoreManagerInterface as StoreManager;
13+
use Magento\Ui\Component\Form\Field;
14+
15+
/**
16+
* Check to disable store view field
17+
*
18+
* Class \Magento\Store\Ui\Component\Form\Field\StoreView
19+
*/
20+
class StoreView extends Field
21+
{
22+
/**
23+
* Store manager
24+
*
25+
* @var StoreManager
26+
*/
27+
private $storeManager;
28+
29+
/**
30+
* StoreView constructor.
31+
*
32+
* @param ContextInterface $context
33+
* @param UiComponentFactory $uiComponentFactory
34+
* @param StoreManager $storeManager
35+
* @param array $components
36+
* @param array $data
37+
*/
38+
public function __construct(
39+
ContextInterface $context,
40+
UiComponentFactory $uiComponentFactory,
41+
StoreManager $storeManager,
42+
array $components = [],
43+
array $data = []
44+
) {
45+
parent::__construct($context, $uiComponentFactory, $components, $data);
46+
$this->storeManager = $storeManager;
47+
}
48+
49+
/**
50+
* Prepare component configuration
51+
*
52+
* @return void
53+
*/
54+
public function prepare()
55+
{
56+
parent::prepare();
57+
if ($this->storeManager->isSingleStoreMode()) {
58+
$this->_data['config']['componentDisabled'] = true;
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)