From bf96a68d58fe77bcebfe351abc67faf8aa7b44a9 Mon Sep 17 00:00:00 2001 From: Pavel Merzlyakov Date: Fri, 2 Feb 2024 10:29:13 +0300 Subject: [PATCH] fix generating json tag --- src/codegen.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/codegen.inc.php b/src/codegen.inc.php index 0bef3e9..3bbbdaf 100644 --- a/src/codegen.inc.php +++ b/src/codegen.inc.php @@ -329,7 +329,11 @@ function add_twig_filters(\Twig\Environment $twig) 'json_tag', function(\mtgMetaField $field): string { $tag = get_field_alias_or_name($field); - return $tag.',string'; + $type = $field->getType(); + if($type instanceof \mtgBuiltinType && !$type->isString() && !$type->isBlob()) { + return $tag.',string'; + } + return $tag; } )); }