Introduced 'go_json_quote' token so wrapping numbers with strings are now optional
Publish PHP Package / docker (push) Successful in 6s Details

This commit is contained in:
Alexey Chubar 2024-05-02 16:37:19 +03:00
parent 72ef58cd55
commit 8a6543ada7
1 changed files with 10 additions and 0 deletions

View File

@ -56,6 +56,8 @@ function supported_tokens()
'default',
'virtual',
'go_json_quote',
'statist',
'statist_skip',
'statist_alias',
@ -330,6 +332,14 @@ function add_twig_filters(\Twig\Environment $twig)
function(\mtgMetaField $field): string {
$tag = get_field_alias_or_name($field);
$type = $field->getType();
//NOTE: currently quoted by default
$quote = !$field->hasToken("go_json_quote") ||
filter_var($field->getToken("go_json_quote"), FILTER_VALIDATE_BOOLEAN) === true;
if(!$quote)
return $tag;
if($type instanceof \mtgMetaEnum ||
($type instanceof \mtgBuiltinType && !$type->isString() && !$type->isBlob())) {
return $tag.',string';