Skip to content

Commit 0965809

Browse files
author
Alexander Akimov
authored
Merge pull request #3899 from magento-tsg/2.1.18-develop-pr66
[TSG] Backporting for 2.1 (pr66) (2.1.18-develop)
2 parents d9259f4 + 875ea5a commit 0965809

File tree

17 files changed

+271
-39
lines changed

17 files changed

+271
-39
lines changed

app/code/Magento/Config/Controller/Adminhtml/System/AbstractConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function _isAllowed()
6868
{
6969
$sectionId = $this->_request->getParam('section');
7070
return parent::_isAllowed()
71-
|| $this->_configStructure->getElement($sectionId)->isAllowed();
71+
&& $this->_configStructure->getElement($sectionId)->isAllowed();
7272
}
7373

7474
/**

app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@ public function getAllOptions()
4848
{
4949
if (!$this->_options) {
5050
$groups = $this->_groupManagement->getLoggedInGroups();
51+
5152
$this->_options = $this->_converter->toOptionArray($groups, 'id', 'code');
53+
54+
array_walk(
55+
$this->_options,
56+
function (&$item) {
57+
$item['__disableTmpl'] = true;
58+
}
59+
);
5260
}
5361
return $this->_options;
5462
}

app/code/Magento/Customer/Model/ResourceModel/GroupRepository.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function __construct(
101101
}
102102

103103
/**
104-
* {@inheritdoc}
104+
* @inheritdoc
105105
*/
106106
public function save(\Magento\Customer\Api\Data\GroupInterface $group)
107107
{
@@ -152,7 +152,7 @@ public function save(\Magento\Customer\Api\Data\GroupInterface $group)
152152
}
153153

154154
/**
155-
* {@inheritdoc}
155+
* @inheritdoc
156156
*/
157157
public function getById($id)
158158
{
@@ -166,7 +166,7 @@ public function getById($id)
166166
}
167167

168168
/**
169-
* {@inheritdoc}
169+
* @inheritdoc
170170
*/
171171
public function getList(SearchCriteriaInterface $searchCriteria)
172172
{
@@ -308,6 +308,7 @@ public function deleteById($id)
308308
*
309309
* @param \Magento\Customer\Api\Data\GroupInterface $group
310310
* @throws InputException
311+
* @throws \Zend_Validate_Exception
311312
* @return void
312313
*
313314
* @SuppressWarnings(PHPMD.NPathComplexity)

app/code/Magento/Customer/Test/Unit/Ui/Component/ColumnFactoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public function testCreate()
9393
]
9494
],
9595
'component' => 'Magento_Ui/js/grid/columns/column',
96+
'__disableTmpl' => 'true',
9697
],
9798
],
9899
'context' => $this->context,

app/code/Magento/Customer/Test/Unit/Ui/Component/FilterFactoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function testCreate()
7272
'config' => [
7373
'dataScope' => $filterName,
7474
'label' => __('Label'),
75+
'__disableTmpl' => 'true',
7576
'options' => [['value' => 'Value', 'label' => 'Label']],
7677
'caption' => __('Select...'),
7778
],

app/code/Magento/Customer/Test/Unit/Ui/Component/Listing/AttributeRepositoryTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ public function testGetList()
144144
'options' => [
145145
[
146146
'label' => 'Label',
147-
'value' => 'Value'
148-
]
147+
'value' => 'Value',
148+
'__disableTmpl' => true,
149+
],
149150
],
150151
'is_used_in_grid' => true,
151152
'is_visible_in_grid' => true,

app/code/Magento/Customer/Ui/Component/ColumnFactory.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Magento\Customer\Ui\Component\Listing\Column\InlineEditUpdater;
1010
use Magento\Customer\Api\CustomerMetadataInterface;
1111

12+
/**
13+
* Class ColumnFactory. Responsible for the column object generation.
14+
*/
1215
class ColumnFactory
1316
{
1417
/** @var \Magento\Framework\View\Element\UiComponentFactory */
@@ -47,6 +50,8 @@ public function __construct(
4750
}
4851

4952
/**
53+
* Creates column object for grid ui component.
54+
*
5055
* @param array $attributeData
5156
* @param string $columnName
5257
* @param \Magento\Framework\View\Element\UiComponent\ContextInterface $context
@@ -55,13 +60,16 @@ public function __construct(
5560
*/
5661
public function create(array $attributeData, $columnName, $context, array $config = [])
5762
{
63+
// @codingStandardsIgnoreStart
5864
$config = array_merge([
5965
'label' => __($attributeData[AttributeMetadata::FRONTEND_LABEL]),
6066
'dataType' => $this->getDataType($attributeData[AttributeMetadata::FRONTEND_INPUT]),
6167
'align' => 'left',
6268
'visible' => (bool)$attributeData[AttributeMetadata::IS_VISIBLE_IN_GRID],
6369
'component' => $this->getJsComponent($this->getDataType($attributeData[AttributeMetadata::FRONTEND_INPUT])),
70+
'__disableTmpl' => 'true',
6471
], $config);
72+
// @codingStandardsIgnoreEnd
6573
if ($attributeData[AttributeMetadata::FRONTEND_INPUT] == 'date') {
6674
$config['dateFormat'] = 'MMM d, y';
6775
$config['timezone'] = false;
@@ -93,6 +101,8 @@ public function create(array $attributeData, $columnName, $context, array $confi
93101
}
94102

95103
/**
104+
* Returns component map.
105+
*
96106
* @param string $dataType
97107
* @return string
98108
*/
@@ -102,6 +112,8 @@ protected function getJsComponent($dataType)
102112
}
103113

104114
/**
115+
* Returns component map depends on data type.
116+
*
105117
* @param string $frontendType
106118
* @return string
107119
*/

app/code/Magento/Customer/Ui/Component/FilterFactory.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
use Magento\Customer\Api\Data\AttributeMetadataInterface as AttributeMetadata;
99

10+
/**
11+
* Class FilterFactory. Responsible for generation filter object.
12+
*/
1013
class FilterFactory
1114
{
1215
/**
@@ -34,16 +37,21 @@ public function __construct(\Magento\Framework\View\Element\UiComponentFactory $
3437
}
3538

3639
/**
40+
* Creates filter object.
41+
*
3742
* @param array $attributeData
3843
* @param \Magento\Framework\View\Element\UiComponent\ContextInterface $context
3944
* @return \Magento\Ui\Component\Listing\Columns\ColumnInterface
4045
*/
4146
public function create(array $attributeData, $context)
4247
{
48+
// @codingStandardsIgnoreStart
4349
$config = [
4450
'dataScope' => $attributeData[AttributeMetadata::ATTRIBUTE_CODE],
4551
'label' => __($attributeData[AttributeMetadata::FRONTEND_LABEL]),
52+
'__disableTmpl' => 'true',
4653
];
54+
// @codingStandardsIgnoreEnd
4755
if ($attributeData[AttributeMetadata::OPTIONS]) {
4856
$config['options'] = $attributeData[AttributeMetadata::OPTIONS];
4957
$config['caption'] = __('Select...');
@@ -63,6 +71,8 @@ public function create(array $attributeData, $context)
6371
}
6472

6573
/**
74+
* Returns filter type.
75+
*
6676
* @param string $frontendInput
6777
* @return string
6878
*/

app/code/Magento/Customer/Ui/Component/Listing/AttributeRepository.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
use Magento\Customer\Api\MetadataManagementInterface;
1414
use Magento\Customer\Model\Indexer\Attribute\Filter;
1515

16+
/**
17+
* Class AttributeRepository
18+
*/
1619
class AttributeRepository
1720
{
1821
const BILLING_ADDRESS_PREFIX = 'billing_';
@@ -57,6 +60,8 @@ public function __construct(
5760
}
5861

5962
/**
63+
* Returns attribute list for current customer.
64+
*
6065
* @return array
6166
*/
6267
public function getList()
@@ -81,6 +86,8 @@ public function getList()
8186
}
8287

8388
/**
89+
* Returns attribute list for given entity type code.
90+
*
8491
* @param AttributeMetadataInterface[] $metadata
8592
* @param string $entityTypeCode
8693
* @param MetadataManagementInterface $management
@@ -124,13 +131,19 @@ protected function getOptionArray(array $options)
124131
{
125132
/** @var \Magento\Customer\Api\Data\OptionInterface $option */
126133
foreach ($options as &$option) {
127-
$option = ['label' => (string)$option->getLabel(), 'value' => $option->getValue()];
134+
$option = [
135+
'label' => (string)$option->getLabel(),
136+
'value' => $option->getValue(),
137+
'__disableTmpl' => true,
138+
];
128139
}
140+
129141
return $options;
130142
}
131143

132-
133144
/**
145+
* Return customer group's metadata by given group code.
146+
*
134147
* @param string $code
135148
* @return []
136149
*/

app/code/Magento/Customer/Ui/Component/Listing/Column/Group/Options.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public function toOptionArray()
4343
if ($this->options === null) {
4444
$this->options = $this->collectionFactory->create()->toOptionArray();
4545
}
46+
47+
array_walk($this->options, function (&$item) {
48+
$item['__disableTmpl'] = true;
49+
});
50+
4651
return $this->options;
4752
}
4853
}

0 commit comments

Comments
 (0)