Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion app/code/Magento/Ui/view/base/web/js/core/renderer/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ define([
*/
build: function (parent, node, name) {
var defaults = parent && parent.childDefaults || {},
children = node.children,
children = this.filterDisabledChildren(node.children),
type = getNodeType(parent, node),
dataScope = getDataScope(parent, node),
component,
Expand Down Expand Up @@ -294,6 +294,35 @@ define([
return node;
},

/**
* Filter out all disabled components.
*
* @param {Object} children
* @returns {*}
*/
filterDisabledChildren: function (children) {
var cIds;

//cleanup children config.componentDisabled = true
if (children && typeof children === 'object') {
cIds = Object.keys(children);

if (cIds) {
_.each(cIds, function (cId) {
if (typeof children[cId] === 'object' &&
children[cId].hasOwnProperty('config') &&
typeof children[cId].config === 'object' &&
children[cId].config.hasOwnProperty('componentDisabled') &&
children[cId].config.componentDisabled === true) {
delete children[cId];
}
});
}
}

return children;
},

/**
* Init component.
*
Expand Down