From 77537dfc873234bf081e55958cd89a1016fb541b Mon Sep 17 00:00:00 2001 From: Ilyas Ronef Date: Thu, 14 May 2020 01:35:33 +0300 Subject: [PATCH 1/2] =?UTF-8?q?+=20Parameters=20=E2=86=92=20`snippets->{$s?= =?UTF-8?q?nippetName}->{$paramName}`:=20As=20opposed=20to=20standard=20CM?= =?UTF-8?q?S=20calling=20you=20can=20pass=20not=20only=20string=20paramete?= =?UTF-8?q?rs=20to=20the=20snippet,=20any=20types=20are=20supported.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- README_ru.md | 3 ++- ddRunSnippets_snippet.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5bbb336..6195b44 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ Elements → Snippets: Create a new snippet with the following data: * Desctription: A snippet parameter, when the key is the parameter name and the value is the parameter value. * Use `[+snippetName+]` for substitution by any previous snippet execution result in the parameter name or value (where `snippetName` is the snippet name). * Or use `[+snippetAlias+]` if specified (e. g. `docs` if the snippet name set as `Ditto=docs`). - * Valid values: `string` + * Valid values: + * `mixed` — as opposed to standard CMS calling you can pass not only string parameters to the snippet, any types are supported * Default value: — * `tpl` diff --git a/README_ru.md b/README_ru.md index 878e35f..6efc225 100644 --- a/README_ru.md +++ b/README_ru.md @@ -51,7 +51,8 @@ * Описание: Параметр сниппета, где ключ — имя параметра, значение — значение параметра. * Используйте `[+snippetName+]` для замены любым предыдущим результатом выполнения сниппета в имени параметра или значении (где `snippetName` — имя сниппета). * Либо используйте псевдоним `[+snippetAlias+]`, если задан (например, `docs`, если имя сниппета задано как `Ditto=docs`). - * Допустимые значения: `string` + * Допустимые значения: + * `mixed` — в отличие от стандартного вызова CMS вы можете передавать не только строковые параметры, поддерживаютя любые типы * Значение по умолчанию: — * `tpl` diff --git a/ddRunSnippets_snippet.php b/ddRunSnippets_snippet.php index 6d3b300..56c7ac4 100644 --- a/ddRunSnippets_snippet.php +++ b/ddRunSnippets_snippet.php @@ -78,6 +78,7 @@ //If parameter value contains placeholders if ( + is_string($aSnippetParamValue) && strpos( $aSnippetParamValue, '[+' @@ -90,7 +91,7 @@ 'mergeAll' => false ]); - //Save parameter with the new name + //Save parameter with the new value $aSnippetParams[$aSnippetParamName] = $aSnippetParamValue; } } From 6faddc57e674fb1974f1dd93cf2cd71ae2824e5a Mon Sep 17 00:00:00 2001 From: Ilyas Ronef Date: Thu, 14 May 2020 01:39:02 +0300 Subject: [PATCH 2/2] Prerelease --- CHANGELOG.md | 4 ++++ CHANGELOG_ru.md | 4 ++++ README.md | 2 +- README_ru.md | 2 +- composer.json | 2 +- ddRunSnippets_snippet.php | 2 +- 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2954c63..c7419ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # (MODX)EvolutionCMS.snippets.ddRunSnippets changelog +## Version 3.1 (2020-05-14) +* \+ Parameters → `snippets->{$snippetName}->{$paramName}`: As opposed to standard CMS calling you can pass not only string parameters to the snippet, any types are supported. + + ## Version 3.0 (2020-05-13) * \* Attention! Backward compatibility is broken. * \* Attention! (MODX)EvolutionCMS.libraries.ddTools >= 0.35.1 is required (not tested in older versions). diff --git a/CHANGELOG_ru.md b/CHANGELOG_ru.md index 80a5d5d..578f2c4 100644 --- a/CHANGELOG_ru.md +++ b/CHANGELOG_ru.md @@ -1,6 +1,10 @@ # (MODX)EvolutionCMS.snippets.ddRunSnippets changelog +## Version 3.1 (2020-05-14) +* \+ Параметры → `snippets->{$snippetName}->{$paramName}`: В отличие от стандартного вызова CMS вы можете передавать не только строковые параметры, поддерживаютя любые типы. + + ## Версия 3.0 (2020-05-13) * \* Внимание! Обратная совместимость нарушена. * \* Внимание! Требуется (MODX)EvolutionCMS.libraries.ddTools >= 0.35.1 (не тестировался с более старыми версиями). diff --git a/README.md b/README.md index 6195b44..326a89e 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ See the documentation for a more complete picture. Elements → Snippets: Create a new snippet with the following data: 1. Snippet name: `ddRunSnippets`. -2. Description: `3.0 Snippet runs necessary snippets with necessary params.`. +2. Description: `3.1 Snippet runs necessary snippets with necessary params.`. 3. Category: `Core`. 4. Parse DocBlock: `no`. 5. Snippet code (php): Insert content of the `ddRunSnippets_snippet.php` file from the archive. diff --git a/README_ru.md b/README_ru.md index 6efc225..bcf2770 100644 --- a/README_ru.md +++ b/README_ru.md @@ -23,7 +23,7 @@ Элементы → Сниппеты: Создайте новый сниппет со следующими параметрами: 1. Название сниппета: `ddRunSnippets`. -2. Описание: `3.0 Сниппет запускает необходимые сниппеты с необходимыми параметрами.`. +2. Описание: `3.1 Сниппет запускает необходимые сниппеты с необходимыми параметрами.`. 3. Категория: `Core`. 4. Анализировать DocBlock: `no`. 5. Код сниппета (php): Вставьте содержимое файла `ddRunSnippets_snippet.php` из архива. diff --git a/composer.json b/composer.json index a2a8dd5..43a91d6 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "dd/evolutioncms-snippets-ddrunsnippets", "type": "modxevo-snippet", - "version": "3.0.0", + "version": "3.1.0", "description": "Snippet runs necessary snippets with necessary params.", "keywords": [ "modx", diff --git a/ddRunSnippets_snippet.php b/ddRunSnippets_snippet.php index 56c7ac4..245719e 100644 --- a/ddRunSnippets_snippet.php +++ b/ddRunSnippets_snippet.php @@ -1,7 +1,7 @@