Skip to content

Commit

Permalink
Merge pull request #1740 from Meteor-Community-Packages/fix/array-lab…
Browse files Browse the repository at this point in the history
…el-hide

Allow to hide labels of array/object fields by schema
  • Loading branch information
jankapunkt authored May 14, 2024
2 parents 7fb1470 + a52d0d2 commit 4a50425
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions autoform-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 4a50425

Please sign in to comment.