Skip to content

Commit ed1f6a5

Browse files
author
Graham Wharton
committed
added component status based filtering
1 parent 80469a6 commit ed1f6a5

File tree

1 file changed

+30
-1
lines changed
  • app/code/Magento/Ui/view/base/web/js/core/renderer

1 file changed

+30
-1
lines changed

app/code/Magento/Ui/view/base/web/js/core/renderer/layout.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ define([
224224
*/
225225
build: function (parent, node, name) {
226226
var defaults = parent && parent.childDefaults || {},
227-
children = node.children,
227+
children = this.filterDisabledChildren(node.children),
228228
type = getNodeType(parent, node),
229229
dataScope = getDataScope(parent, node),
230230
component,
@@ -294,6 +294,35 @@ define([
294294
return node;
295295
},
296296

297+
/**
298+
* Filter out all disabled components.
299+
*
300+
* @param {Object} children
301+
* @returns {*}
302+
*/
303+
filterDisabledChildren: function (children) {
304+
var cIds;
305+
306+
//cleanup children config.componentDisabled = true
307+
if (children && typeof children === 'object') {
308+
cIds = Object.keys(children);
309+
310+
if (cIds) {
311+
_.each(cIds, function (cId) {
312+
if (typeof children[cId] === 'object' &&
313+
children[cId].hasOwnProperty('config') &&
314+
typeof children[cId].config === 'object' &&
315+
children[cId].config.hasOwnProperty('componentDisabled') &&
316+
children[cId].config.componentDisabled === true) {
317+
delete children[cId];
318+
}
319+
});
320+
}
321+
}
322+
323+
return children;
324+
},
325+
297326
/**
298327
* Init component.
299328
*

0 commit comments

Comments
 (0)