From a52d0d2738bbedfe4b05655ccc4bd4adad0ec686 Mon Sep 17 00:00:00 2001 From: jankapunkt Date: Tue, 14 May 2024 08:37:50 +0200 Subject: [PATCH] fix: return null if label or atts.label is set to false/null in afFieldLabelHelper --- autoform-helpers.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/autoform-helpers.js b/autoform-helpers.js index c7d5577c..14e4e0b0 100644 --- a/autoform-helpers.js +++ b/autoform-helpers.js @@ -216,6 +216,13 @@ Template.registerHelper('afFieldValueContains', autoFormFieldValueContains) * @return {Object} */ export const autoFormFieldLabelText = function autoFormFieldLabelText (options) { + // in some cases we want to define labels als hidden under the autoform ctx + // but remain visible in the overall schema ctx (so their name is shown + // during validation) which causes label / atts.label to be false + const self = this + if ([null, false].includes(self?.label ?? self?.atts?.label)) { + return null + } options = parseOptions(options, 'afFieldLabelText', true) return AutoForm.getLabelForField(options.name) }