File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed
Model/Config/Source/Product/Options
lib/internal/Magento/Framework/View/Element/Html Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public function toOptionArray()
43
43
$ types [] = ['label ' => __ ($ type ['label ' ]), 'value ' => $ type ['name ' ]];
44
44
}
45
45
if (count ($ types )) {
46
- $ groups [] = ['label ' => __ ($ option ['label ' ]), 'value ' => $ types ];
46
+ $ groups [] = ['label ' => __ ($ option ['label ' ]), 'value ' => $ types, ' optgroup-name ' => $ option [ ' label ' ] ];
47
47
}
48
48
}
49
49
Original file line number Diff line number Diff line change @@ -194,7 +194,8 @@ define([
194
194
var widget = this ,
195
195
currentElement = $ ( event . target ) ,
196
196
parentId = '#' + currentElement . closest ( '.fieldset-alt' ) . attr ( 'id' ) ,
197
- group = currentElement . find ( '[value="' + currentElement . val ( ) + '"]' ) . closest ( 'optgroup' ) . attr ( 'data-name' ) ,
197
+ group = currentElement . find ( '[value="' + currentElement . val ( ) + '"]' )
198
+ . closest ( 'optgroup' ) . attr ( 'data-optgroup-name' ) ,
198
199
previousGroup = $ ( parentId + '_previous_group' ) . val ( ) ,
199
200
previousBlock = $ ( parentId + '_type_' + previousGroup ) ,
200
201
tmpl ;
Original file line number Diff line number Diff line change @@ -151,21 +151,21 @@ protected function _toHtml()
151
151
152
152
$ isArrayOption = true ;
153
153
foreach ($ this ->getOptions () as $ key => $ option ) {
154
+ $ optgroupName = '' ;
154
155
if ($ isArrayOption && is_array ($ option )) {
155
156
$ value = $ option ['value ' ];
156
157
$ label = (string )$ option ['label ' ];
157
- $ name = $ option ['label ' ] instanceof \ Magento \ Framework \Phrase ? $ option ['label ' ]-> getText () : $ label ;
158
+ $ optgroupName = isset ( $ option ['optgroup-name ' ]) ? $ option ['optgroup-name ' ] : $ label ;
158
159
$ params = !empty ($ option ['params ' ]) ? $ option ['params ' ] : [];
159
160
} else {
160
161
$ value = (string )$ key ;
161
162
$ label = (string )$ option ;
162
- $ name = $ label ;
163
163
$ isArrayOption = false ;
164
164
$ params = [];
165
165
}
166
166
167
167
if (is_array ($ value )) {
168
- $ html .= '<optgroup label=" ' . $ label . '" data-name=" ' . $ name . '"> ' ;
168
+ $ html .= '<optgroup label=" ' . $ label . '" data-optgroup- name=" ' . $ optgroupName . '"> ' ;
169
169
foreach ($ value as $ keyGroup => $ optionGroup ) {
170
170
if (!is_array ($ optionGroup )) {
171
171
$ optionGroup = ['value ' => $ keyGroup , 'label ' => $ optionGroup ];
You can’t perform that action at this time.
0 commit comments