From 4860cf360e1af565619a74b2928d6a07f891e85a Mon Sep 17 00:00:00 2001 From: Ilyas Ronef Date: Fri, 30 Sep 2022 14:29:02 +0400 Subject: [PATCH] =?UTF-8?q?+=20Outputters=20=E2=86=92=20Json=20=E2=86=92?= =?UTF-8?q?=20Parameters=20=E2=86=92=20`outputterParams->templates->{$docF?= =?UTF-8?q?ieldName}`=20=E2=86=92=20Placeholders:=20The=20new=20placeholde?= =?UTF-8?q?rs=20contain=20any=20document=20field=20name=20or=20TV=20specif?= =?UTF-8?q?ied=20in=20`outputterParams->docFields`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- src/Outputter/Json/Outputter.php | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1fe8224..b512f22 100644 --- a/README.md +++ b/README.md @@ -297,7 +297,8 @@ Get resources from custom DB table. It is useful for manipulations with doc field values through running snippets. Available placeholders: - * `[+value+]` — document field value + * `[+value+]` — the field value + * `[+`any document field or tv name`+]` — Any document field name or TV specified in `outputterParams->docFields` * Valid values: * `stringChunkName` * `string` — use inline templates starting with `@CODE:` diff --git a/src/Outputter/Json/Outputter.php b/src/Outputter/Json/Outputter.php index 75e1b20..1667faf 100644 --- a/src/Outputter/Json/Outputter.php +++ b/src/Outputter/Json/Outputter.php @@ -7,7 +7,7 @@ class Outputter extends \ddGetDocuments\Outputter\Outputter { /** * parse - * @version 2.2 (2021-07-12) + * @version 2.3 (2022-09-30) * * @param $data {Output} * @@ -39,9 +39,14 @@ public function parse(Output $data){ ){ $result_item[$docField] = \ddTools::parseSource(\ddTools::parseText([ 'text' => $this->templates->{$docField}, - 'data' => [ - 'value' => $result_item[$docField] - ] + 'data' => \DDTools\ObjectTools::extend([ + 'objects' => [ + $itemData, + [ + 'value' => $result_item[$docField] + ] + ] + ]) ])); } }