From e5eb8025212a336d6303f5d9c9d4a08a65c4c46e Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 13 Sep 2022 10:17:16 +0300 Subject: [PATCH] feat(directives): add ability to disable types using `!types` --- src/flextype/core/Entries/Directives/TypesDirective.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/flextype/core/Entries/Directives/TypesDirective.php b/src/flextype/core/Entries/Directives/TypesDirective.php index 99265c55..8fb1ac85 100644 --- a/src/flextype/core/Entries/Directives/TypesDirective.php +++ b/src/flextype/core/Entries/Directives/TypesDirective.php @@ -32,6 +32,10 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void { $field = entries()->registry()->get('methods.fetch.field'); + if (is_string($field['value']) && strings($field['value'])->contains('!types')) { + return; + } + if (is_string($field['value'])) { if (strings($field['value'])->contains('@type[integer]')) { $field['value'] = strings(strings($field['value'])->replace('@type[integer]', '')->trim())->toInteger();