Skip to content

Commit

Permalink
+ Outputters → Json → Parameters → `outputterParams->templates->{$doc…
Browse files Browse the repository at this point in the history
…FieldName}` → Placeholders: The new placeholders contain any document field name or TV specified in `outputterParams->docFields`.
  • Loading branch information
Ronef committed Sep 30, 2022
1 parent 9f8e768 commit 4860cf3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:`
Expand Down
13 changes: 9 additions & 4 deletions src/Outputter/Json/Outputter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}
*
Expand Down Expand Up @@ -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]
]
]
])
]));
}
}
Expand Down

0 comments on commit 4860cf3

Please sign in to comment.