From 85042827d7af4b6b3b7375e59ce27281e36258af Mon Sep 17 00:00:00 2001 From: Jeffrey Horton Date: Mon, 19 Feb 2024 15:06:29 +0000 Subject: [PATCH] [ASL-4474] Allow passing data for mustache templates when rendering field labels, hints and errors. --- src/fieldset/index.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/fieldset/index.jsx b/src/fieldset/index.jsx index 3b99cf70..33dac4ee 100644 --- a/src/fieldset/index.jsx +++ b/src/fieldset/index.jsx @@ -224,10 +224,12 @@ function Field({ hint = { hint }; } + const snippetProps = props.formatters?.[name]?.renderContext ?? {}; + return {`fields.${name}.label`} : label} - hint={isUndefined(hint) ? {`fields.${name}.hint`} : hint} - error={error && {`errors.${name}.${error}`}} + label={isUndefined(label) ? {`fields.${name}.label`} : label} + hint={isUndefined(hint) ? {`fields.${name}.hint`} : hint} + error={error && {`errors.${name}.${error}`}} value={fieldValue} onChange={onFieldChange} name={prefix ? `${prefix}-${name}` : name}