Skip to content

Commit 395d85f

Browse files
author
Natalia Momotenko
committed
Merge remote-tracking branch 'origin/develop' into PR-4
2 parents 349d7aa + 1feb9f4 commit 395d85f

File tree

16 files changed

+1043
-740
lines changed

16 files changed

+1043
-740
lines changed

app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options/Text.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,25 @@ class Text extends AbstractSwatch
1414
* @var string
1515
*/
1616
protected $_template = 'Magento_Swatches::catalog/product/attribute/text.phtml';
17+
18+
/**
19+
* Return json config for text option JS initialization
20+
*
21+
* @return array
22+
*/
23+
public function getJsonConfig()
24+
{
25+
$values = [];
26+
foreach ($this->getOptionValues() as $value) {
27+
$values[] = $value->getData();
28+
}
29+
30+
$data = [
31+
'attributesData' => $values,
32+
'isSortable' => (int)(!$this->getReadOnly() && !$this->canManageOptionDefaultOnly()),
33+
'isReadOnly' => (int)$this->getReadOnly()
34+
];
35+
36+
return json_encode($data);
37+
}
1738
}

app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options/Visual.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,28 @@ protected function createStoreValues($storeId, $optionId)
5252
return $value;
5353
}
5454

55+
/**
56+
* Return json config for visual option JS initialization
57+
*
58+
* @return array
59+
*/
60+
public function getJsonConfig()
61+
{
62+
$values = [];
63+
foreach ($this->getOptionValues() as $value) {
64+
$values[] = $value->getData();
65+
}
66+
67+
$data = [
68+
'attributesData' => $values,
69+
'uploadActionUrl' => $this->getUrl('swatches/iframe/show'),
70+
'isSortable' => (int)(!$this->getReadOnly() && !$this->canManageOptionDefaultOnly()),
71+
'isReadOnly' => (int)$this->getReadOnly()
72+
];
73+
74+
return json_encode($data);
75+
}
76+
5577
/**
5678
* Parse swatch labels for template
5779
*

app/code/Magento/Swatches/view/adminhtml/layout/catalog_product_attribute_edit.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<css src="Magento_Swatches::css/swatches.css"/>
1111
<css src="jquery/colorpicker/css/colorpicker.css"/>
1212
<link src="jquery/colorpicker/js/colorpicker.js"/>
13-
<link src="Magento_Swatches::js/TypeChanger.js"/>
1413
</head>
1514
<body>
1615
<referenceContainer name="main">

app/code/Magento/Swatches/view/adminhtml/layout/catalog_product_attribute_edit_popup.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<css src="Magento_Swatches::css/swatches.css"/>
1111
<css src="jquery/colorpicker/css/colorpicker.css"/>
1212
<link src="jquery/colorpicker/js/colorpicker.js"/>
13-
<link src="Magento_Swatches::js/TypeChanger.js"/>
1413
</head>
1514
<body>
1615
<referenceContainer name="form">
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Copyright © 2015 Magento. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
var config = {
7+
map: {
8+
'*': {
9+
swatchesProductAttributes: 'Magento_Swatches/js/product-attributes',
10+
swatchesTypeChange: 'Magento_Swatches/js/type-change'
11+
}
12+
}
13+
};

0 commit comments

Comments
 (0)