Skip to content

Commit 53af252

Browse files
committed
MAGETWO-97046: Incorrect rendering
1 parent d9259f4 commit 53af252

File tree

11 files changed

+102
-12
lines changed

11 files changed

+102
-12
lines changed

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: 10 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
@@ -61,6 +66,7 @@ public function create(array $attributeData, $columnName, $context, array $confi
6166
'align' => 'left',
6267
'visible' => (bool)$attributeData[AttributeMetadata::IS_VISIBLE_IN_GRID],
6368
'component' => $this->getJsComponent($this->getDataType($attributeData[AttributeMetadata::FRONTEND_INPUT])),
69+
'__disableTmpl' => 'true',
6470
], $config);
6571
if ($attributeData[AttributeMetadata::FRONTEND_INPUT] == 'date') {
6672
$config['dateFormat'] = 'MMM d, y';
@@ -93,6 +99,8 @@ public function create(array $attributeData, $columnName, $context, array $confi
9399
}
94100

95101
/**
102+
* Returns component map.
103+
*
96104
* @param string $dataType
97105
* @return string
98106
*/
@@ -102,6 +110,8 @@ protected function getJsComponent($dataType)
102110
}
103111

104112
/**
113+
* Returns component map depends on data type.
114+
*
105115
* @param string $frontendType
106116
* @return string
107117
*/

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

Lines changed: 8 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,6 +37,8 @@ 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
@@ -43,6 +48,7 @@ public function create(array $attributeData, $context)
4348
$config = [
4449
'dataScope' => $attributeData[AttributeMetadata::ATTRIBUTE_CODE],
4550
'label' => __($attributeData[AttributeMetadata::FRONTEND_LABEL]),
51+
'__disableTmpl' => 'true',
4652
];
4753
if ($attributeData[AttributeMetadata::OPTIONS]) {
4854
$config['options'] = $attributeData[AttributeMetadata::OPTIONS];
@@ -63,6 +69,8 @@ public function create(array $attributeData, $context)
6369
}
6470

6571
/**
72+
* Returns filter type.
73+
*
6674
* @param string $frontendInput
6775
* @return string
6876
*/

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

Lines changed: 15 additions & 1 deletion
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,20 @@ 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

132144

133145
/**
146+
* Return customer group's metadata by given group code.
147+
*
134148
* @param string $code
135149
* @return []
136150
*/

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
}

app/code/Magento/Customer/Ui/Component/MassAction/Group/Options.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Customer\Ui\Component\MassAction\Group;
77

8+
use Magento\Framework\Phrase;
89
use Magento\Framework\UrlInterface;
910
use Zend\Stdlib\JsonSerializable;
1011
use Magento\Customer\Model\ResourceModel\Group\CollectionFactory;
@@ -87,7 +88,8 @@ public function jsonSerialize()
8788
foreach ($options as $optionCode) {
8889
$this->options[$optionCode['value']] = [
8990
'type' => 'customer_group_' . $optionCode['value'],
90-
'label' => $optionCode['label'],
91+
'label' => __($optionCode['label']),
92+
'__disableTmpl' => true,
9193
];
9294

9395
if ($this->urlPath && $this->paramName) {
@@ -124,6 +126,11 @@ protected function prepareData()
124126
case 'paramName':
125127
$this->paramName = $value;
126128
break;
129+
case 'confirm':
130+
foreach ($value as $messageName => $message) {
131+
$this->additionalData[$key][$messageName] = (string) new Phrase($message);
132+
}
133+
break;
127134
default:
128135
$this->additionalData[$key] = $value;
129136
break;

0 commit comments

Comments
 (0)