Skip to content

Commit

Permalink
Version 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronef committed Feb 28, 2021
2 parents 2571b9d + 7d42564 commit 8d9a327
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# (MODX)EvolutionCMS.snippets.ddGetDocuments changelog


## Version 1.3.1 (2021-02-28)
* \* Outputters → String → Parameters → `outputterParams->placeholders`: Fixed critical error when the parameter is used.


## Version 1.3 (2021-02-27)
* \* Attention! (MODX)Evolution.libraries.ddTools >= 0.42 is required.
* \* Parameters: The following parameters were moved from Snippet to Provider (with backward compatibility):
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A snippet for fetching and parsing resources from the document tree or custom DB
#### 1. Elements → Snippets: Create a new snippet with the following data

1. Snippet name: `ddGetDocuments`.
2. Description: `<b>1.3</b> A snippet for fetching and parsing resources from the document tree or custom DB table by a custom rule.`.
2. Description: `<b>1.3.1</b> A snippet for fetching and parsing resources from the document tree or custom DB table by a custom rule.`.
3. Category: `Core`.
4. Parse DocBlock: `no`.
5. Snippet code (php): Insert content of the `ddGetDocuments_snippet.php` file from the archive.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dd/evolutioncms-snippets-ddgetdocuments",
"type": "modxevo-snippet",
"version": "1.3.0",
"version": "1.3.1",
"description": "A snippet for fetching and parsing resources from the document tree or custom DB table by a custom rule.",
"keywords": [
"modx",
Expand Down
2 changes: 1 addition & 1 deletion ddGetDocuments_snippet.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* ddGetDocuments
* @version 1.3 (2021-02-27)
* @version 1.3.1 (2021-02-28)
*
* @see README.md
*
Expand Down
52 changes: 30 additions & 22 deletions src/Outputter/String/Outputter.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct($params){

/**
* parse
* @version 2.1.2 (2019-03-19)
* @version 2.1.3 (2021-02-28)
*
* @param $data {Output}
*
Expand All @@ -85,18 +85,22 @@ public function parse(Output $data){
'totalFound' => $data->provider->totalFound
];

$generalPlaceholders = array_merge(
$generalPlaceholders,
$this->placeholders
);
$generalPlaceholders = \DDTools\ObjectTools::extend([
'objects' => [
$generalPlaceholders,
$this->placeholders
]
]);

if(isset($data->extenders)){
$generalPlaceholders = array_merge(
$generalPlaceholders,
[
'extenders' => $data->extenders
$generalPlaceholders = \DDTools\ObjectTools::extend([
'objects' => [
$generalPlaceholders,
[
'extenders' => $data->extenders
]
]
);
]);

$generalPlaceholders = \ddTools::unfoldArray($generalPlaceholders);
}
Expand All @@ -123,14 +127,16 @@ public function parse(Output $data){

$resultItems[] = \ddTools::parseSource(\ddTools::parseText([
'text' => $chunkName,
'data' => array_merge(
$item,
$generalPlaceholders,
[
'itemNumber' => $index + 1,
'itemNumberZeroBased' => $index
'data' => \DDTools\ObjectTools::extend([
'objects' => [
$item,
$generalPlaceholders,
[
'itemNumber' => $index + 1,
'itemNumberZeroBased' => $index
]
]
)
])
]));
}
}
Expand Down Expand Up @@ -159,12 +165,14 @@ public function parse(Output $data){
}elseif($this->wrapperTpl !== null){
$result = \ddTools::parseText([
'text' => \ddTools::$modx->getTpl($this->wrapperTpl),
'data' => array_merge(
$generalPlaceholders,
[
'ddGetDocuments_items' => $result
'data' => \DDTools\ObjectTools::extend([
'objects' => [
$generalPlaceholders,
[
'ddGetDocuments_items' => $result
]
]
)
])
]);
}

Expand Down

0 comments on commit 8d9a327

Please sign in to comment.