From 8d97168e5363ed27a3c8a67650fcb111c3e0f3d8 Mon Sep 17 00:00:00 2001 From: Ilyas Ronef Date: Sun, 28 Feb 2021 16:16:08 +0300 Subject: [PATCH 1/2] =?UTF-8?q?*=20Outputters=20=E2=86=92=20String=20?= =?UTF-8?q?=E2=86=92=C2=A0Parameters=20=E2=86=92=C2=A0`outputterParams->pl?= =?UTF-8?q?aceholders`:=20Fixed=20critical=20error=20when=20the=20paramete?= =?UTF-8?q?r=20is=20used.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Outputter/String/Outputter.php | 52 +++++++++++++++++------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/src/Outputter/String/Outputter.php b/src/Outputter/String/Outputter.php index eb48c46..a0e7b18 100644 --- a/src/Outputter/String/Outputter.php +++ b/src/Outputter/String/Outputter.php @@ -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} * @@ -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); } @@ -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 + ] ] - ) + ]) ])); } } @@ -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 + ] ] - ) + ]) ]); } From 7d425640a60c05196fedcae26959affdce604a8b Mon Sep 17 00:00:00 2001 From: Ilyas Ronef Date: Sun, 28 Feb 2021 16:19:26 +0300 Subject: [PATCH 2/2] Prerelease --- CHANGELOG.md | 4 ++++ README.md | 2 +- composer.json | 2 +- ddGetDocuments_snippet.php | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54c7f2d..277de3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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): diff --git a/README.md b/README.md index afaed8b..3dce8e6 100644 --- a/README.md +++ b/README.md @@ -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: `1.3 A snippet for fetching and parsing resources from the document tree or custom DB table by a custom rule.`. +2. Description: `1.3.1 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. diff --git a/composer.json b/composer.json index e2707ed..c5751fa 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/ddGetDocuments_snippet.php b/ddGetDocuments_snippet.php index cdff53f..a14699c 100644 --- a/ddGetDocuments_snippet.php +++ b/ddGetDocuments_snippet.php @@ -1,7 +1,7 @@