Skip to content

Commit 61773e8

Browse files
author
Ihor Melnychenko
committed
MAGETWO-38867: Create mixin for declarative widget description
1 parent b3825ca commit 61773e8

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lib/web/mage/apply/scripts.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,25 @@ define([
3232
* @param {HTMLElement} elem - Element whose data should be modified.
3333
*/
3434
function setData(components, elem) {
35-
var data = elem.getAttribute(dataAttr);
35+
var data = elem.getAttribute(dataAttr),
36+
iterator;
3637

3738
data = !!data ? JSON.parse(data) : {};
39+
40+
if(components.mixins) {
41+
data.mixins = data.mixins || {};
42+
43+
for(iterator in components.mixins){
44+
if(!data.mixins[iterator]) {
45+
data.mixins[iterator] = components.mixins[iterator].slice();
46+
}else {
47+
data.mixins[iterator] = data.mixins[iterator].concat(components.mixins[iterator]);
48+
}
49+
}
50+
51+
delete components.mixins;
52+
}
53+
3854
data = $.extend(true, data, components);
3955
data = JSON.stringify(data);
4056

0 commit comments

Comments
 (0)