Skip to content

Commit 405ed44

Browse files
authored
Falling back to contentTypeName when Block List label is empty (#10963)
* Falling back to contentTypeName when Block List label is empty * Adding $contentTypeName variable for Block List labels
1 parent 1e1276f commit 405ed44

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Umbraco.Web.UI.Client/src/common/services/blockeditormodelobject.service.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,21 @@
9999
}
100100
}
101101

102-
103102
/**
104103
* Generate label for Block, uses either the labelInterpolator or falls back to the contentTypeName.
105104
* @param {Object} blockObject BlockObject to recive data values from.
106105
*/
107106
function getBlockLabel(blockObject) {
108107
if (blockObject.labelInterpolator !== undefined) {
109-
var labelVars = Object.assign({"$settings": blockObject.settingsData || {}, "$layout": blockObject.layout || {}, "$index": (blockObject.index || 0)+1 }, blockObject.data);
110-
return blockObject.labelInterpolator(labelVars);
108+
var labelVars = Object.assign({"$contentTypeName": blockObject.content.contentTypeName, "$settings": blockObject.settingsData || {}, "$layout": blockObject.layout || {}, "$index": (blockObject.index || 0)+1 }, blockObject.data);
109+
var label = blockObject.labelInterpolator(labelVars);
110+
if (label) {
111+
return label;
112+
}
111113
}
112114
return blockObject.content.contentTypeName;
113115
}
114116

115-
116117
/**
117118
* Used to add watchers on all properties in a content or settings model
118119
*/

0 commit comments

Comments
 (0)