Skip to content

Commit

Permalink
Version 3.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronef committed Jun 9, 2022
2 parents d546032 + ab5c3da commit 5994bdc
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 29 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.ddGetMultipleField changelog


## Version 3.8.1 (2022-06-09)
* \* Parameters → `colTpl`: Support of various column numbers in different rows has been improved.


## Version 3.8 (2022-06-04)
* \* Parameters:
* \+ `inputString`: Supports JSON with any nesting level.
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG_ru.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# (MODX)EvolutionCMS.snippets.ddGetMultipleField changelog


## Version 3.8 (2022-06-04)
## Версия 3.8.1 (2022-06-09)
* \* Параметры → `colTpl`: Улучшена поддержка различного количества колонок в разных строках.


## Версия 3.8 (2022-06-04)
* \* Параметры:
* \+ `inputString`: Поддерживает JSON с любым уровнем вложенности.
* \+ `colTpl[$i]` → Плейсхолдеры:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Features:
#### 1. Elements → Snippets: Create a new snippet with the following data

1. Snippet name: `ddGetMultipleField`.
2. Description: `<b>3.8</b> A snippet for processing, manipulations and custom output structured data (JSON or separated by delimiters strings).`.
2. Description: `<b>3.8.1</b> A snippet for processing, manipulations and custom output structured data (JSON or separated by delimiters strings).`.
3. Category: `Core`.
4. Parse DocBlock: `no`.
5. Snippet code (php): Insert content of the `ddGetMultipleField_snippet.php` file from the archive.
Expand Down
2 changes: 1 addition & 1 deletion README_ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#### 1. Элементы → Сниппеты: Создайте новый сниппет со следующими параметрами

1. Название сниппета: `ddGetMultipleField`.
2. Описание: `<b>3.8</b> Сниппет для обработки, изменения и произвольного вывода структурированных данных (JSON или разделённых через определённые разделители).`.
2. Описание: `<b>3.8.1</b> Сниппет для обработки, изменения и произвольного вывода структурированных данных (JSON или разделённых через определённые разделители).`.
3. Категория: `Core`.
4. Анализировать DocBlock: `no`.
5. Код сниппета (php): Вставьте содержимое файла `ddGetMultipleField_snippet.php` из архива.
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-ddgetmultiplefield",
"type": "modxevo-snippet",
"version": "3.8.0",
"version": "3.8.1",
"description": "A snippet for processing, manipulations and custom output structured data (JSON or separated by delimiters strings).",
"keywords": [
"modx",
Expand Down
2 changes: 1 addition & 1 deletion ddGetMultipleField_snippet.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* ddGetMultipleField
* @version 3.8 (2022-06-04)
* @version 3.8.1 (2022-06-09)
*
* @see README.md
*
Expand Down
33 changes: 9 additions & 24 deletions src/Snippet.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Snippet extends \DDTools\Snippet {
protected
$version = '3.8.0',
$version = '3.8.1',

$params = [
//Defaults
Expand Down Expand Up @@ -236,7 +236,7 @@ protected function prepareParams($params = []){

/**
* run
* @version 1.6.1 (2022-06-04)
* @version 1.6.2 (2022-06-09)
*
* @return {string}
*/
Expand Down Expand Up @@ -535,27 +535,6 @@ function(){
$this->params->outputFormat == 'html' ||
$this->params->outputFormat == 'htmlarray'
){
if (
//Если шаблоны колонок заданы
!empty($this->params->colTpl) &&
//Но их не хватает
(
$temp =
count(array_values($data)[0]) -
count($this->params->colTpl)
) > 0
){
//Дозабьём недостающие последним
$this->params->colTpl = array_merge(
$this->params->colTpl,
array_fill(
$temp - 1,
$temp,
$this->params->colTpl[count($this->params->colTpl) - 1]
)
);
}

$rowIndex = 0;

//Перебираем строки
Expand Down Expand Up @@ -602,7 +581,13 @@ function(){
]);
}

//If template for the column exists
//If template for this column is not set
if (!isset($this->params->colTpl[$columnIndex])){
//Use previous
$this->params->colTpl[$columnIndex] = $this->params->colTpl[$columnIndex - 1];
}

//If template for the column is needed
if (!empty($this->params->colTpl[$columnIndex])){
$columnValue = \ddTools::parseText([
'text' => $this->params->colTpl[$columnIndex],
Expand Down

0 comments on commit 5994bdc

Please sign in to comment.