Skip to content

Commit 4a50425

Browse files
authored
Merge pull request #1740 from Meteor-Community-Packages/fix/array-label-hide
Allow to hide labels of array/object fields by schema
2 parents 7fb1470 + a52d0d2 commit 4a50425

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)