Skip to content

Commit a52d0d2

Browse files
committed
fix: return null if label or atts.label is set to false/null in afFieldLabelHelper
1 parent 7fb1470 commit a52d0d2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

autoform-helpers.js

+7
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ Template.registerHelper('afFieldValueContains', autoFormFieldValueContains)
216216
* @return {Object}
217217
*/
218218
export const autoFormFieldLabelText = function autoFormFieldLabelText (options) {
219+
// in some cases we want to define labels als hidden under the autoform ctx
220+
// but remain visible in the overall schema ctx (so their name is shown
221+
// during validation) which causes label / atts.label to be false
222+
const self = this
223+
if ([null, false].includes(self?.label ?? self?.atts?.label)) {
224+
return null
225+
}
219226
options = parseOptions(options, 'afFieldLabelText', true)
220227
return AutoForm.getLabelForField(options.name)
221228
}

0 commit comments

Comments
 (0)