From aa05d15bc91eaf9d298f2889b2483ab2e1a78886 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 13 Sep 2022 10:15:19 +0300 Subject: [PATCH] feat(directives): add ability to disable shortcodes using `!shortcodes` --- src/flextype/core/Entries/Directives/ShortcodesDirective.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/flextype/core/Entries/Directives/ShortcodesDirective.php b/src/flextype/core/Entries/Directives/ShortcodesDirective.php index 8f33f9de..10504b1e 100644 --- a/src/flextype/core/Entries/Directives/ShortcodesDirective.php +++ b/src/flextype/core/Entries/Directives/ShortcodesDirective.php @@ -36,6 +36,10 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void { $field = entries()->registry()->get('methods.fetch.field'); + if (is_string($field['value']) && strings($field['value'])->contains('!shortcodes')) { + return; + } + if (is_string($field['value'])) { if (strings($field['value'])->contains('@shortcodes')) { $field['value'] = strings(parsers()->shortcodes()->parse($field['value']))->replace('@shortcodes', '')->trim()->toString();