1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-07 21:56:33 +02:00

feat(directives): small update for calc directive

This commit is contained in:
Awilum
2022-05-22 09:57:05 +03:00
parent e1c05209d1
commit fa71728685

View File

@@ -28,7 +28,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\[(.*?)\]/s', function($matches) use ($result) {
$field['value'] = preg_replace_callback('/@calc\[(.*?)\]/s', function($matches) {
return (new StringCalc())->calculate($matches[1]);
}, $field['value']);
}