From 4e9acc350e64e139fb379b9d2f9ff703fc6185ee Mon Sep 17 00:00:00 2001 From: Awilum Date: Sat, 14 May 2022 15:32:29 +0300 Subject: [PATCH] feat(directives): use `/s` for regex --- src/flextype/core/Entries/Directives/CalcDirective.php | 2 +- src/flextype/core/Entries/Directives/FieldsDirective.php | 2 +- src/flextype/core/Entries/Directives/VarsDirective.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/flextype/core/Entries/Directives/CalcDirective.php b/src/flextype/core/Entries/Directives/CalcDirective.php index 04e9417a..00becef2 100644 --- a/src/flextype/core/Entries/Directives/CalcDirective.php +++ b/src/flextype/core/Entries/Directives/CalcDirective.php @@ -27,7 +27,7 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void { $result = entries()->registry()->get('methods.fetch.result'); if (is_string($field['value'])) { - $field['value'] = preg_replace_callback('/@calc\((.*?)\)/', function($matches) use ($result) { + $field['value'] = preg_replace_callback('/@calc\((.*?)\)/s', function($matches) use ($result) { return (new StringCalc())->calculate($matches[1]); }, $field['value']); } diff --git a/src/flextype/core/Entries/Directives/FieldsDirective.php b/src/flextype/core/Entries/Directives/FieldsDirective.php index 2dfda691..6a7b0e79 100644 --- a/src/flextype/core/Entries/Directives/FieldsDirective.php +++ b/src/flextype/core/Entries/Directives/FieldsDirective.php @@ -26,7 +26,7 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void { $result = entries()->registry()->get('methods.fetch.result'); if (is_string($field['value'])) { - $field['value'] = preg_replace_callback('/@field\((.*?)\)/', function($matches) use ($result) { + $field['value'] = preg_replace_callback('/@field\((.*?)\)/s', function($matches) use ($result) { return collection($result)->get($matches[1]); }, $field['value']); } diff --git a/src/flextype/core/Entries/Directives/VarsDirective.php b/src/flextype/core/Entries/Directives/VarsDirective.php index e9fb6dcc..54d0d9c5 100644 --- a/src/flextype/core/Entries/Directives/VarsDirective.php +++ b/src/flextype/core/Entries/Directives/VarsDirective.php @@ -26,7 +26,7 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void { $result = entries()->registry()->get('methods.fetch.result'); if (is_string($field['value'])) { - $field['value'] = preg_replace_callback('/@var\((.*?)\)/', function($matches) use ($result) { + $field['value'] = preg_replace_callback('/@var\((.*?)\)/s', function($matches) use ($result) { return collection($result['vars'])->get($matches[1]); }, $field['value']); }