Skip to content

Commit 5994bdc

Browse files
committed
Version 3.8.1
2 parents d546032 + ab5c3da commit 5994bdc

7 files changed

Lines changed: 22 additions & 29 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# (MODX)EvolutionCMS.snippets.ddGetMultipleField changelog
22

33

4+
## Version 3.8.1 (2022-06-09)
5+
* \* Parameters → `colTpl`: Support of various column numbers in different rows has been improved.
6+
7+
48
## Version 3.8 (2022-06-04)
59
* \* Parameters:
610
* \+ `inputString`: Supports JSON with any nesting level.

CHANGELOG_ru.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# (MODX)EvolutionCMS.snippets.ddGetMultipleField changelog
22

33

4-
## Version 3.8 (2022-06-04)
4+
## Версия 3.8.1 (2022-06-09)
5+
* \* Параметры → `colTpl`: Улучшена поддержка различного количества колонок в разных строках.
6+
7+
8+
## Версия 3.8 (2022-06-04)
59
* \* Параметры:
610
* \+ `inputString`: Поддерживает JSON с любым уровнем вложенности.
711
* \+ `colTpl[$i]` → Плейсхолдеры:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Features:
3434
#### 1. Elements → Snippets: Create a new snippet with the following data
3535

3636
1. Snippet name: `ddGetMultipleField`.
37-
2. Description: `<b>3.8</b> A snippet for processing, manipulations and custom output structured data (JSON or separated by delimiters strings).`.
37+
2. Description: `<b>3.8.1</b> A snippet for processing, manipulations and custom output structured data (JSON or separated by delimiters strings).`.
3838
3. Category: `Core`.
3939
4. Parse DocBlock: `no`.
4040
5. Snippet code (php): Insert content of the `ddGetMultipleField_snippet.php` file from the archive.

README_ru.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#### 1. Элементы → Сниппеты: Создайте новый сниппет со следующими параметрами
3535

3636
1. Название сниппета: `ddGetMultipleField`.
37-
2. Описание: `<b>3.8</b> Сниппет для обработки, изменения и произвольного вывода структурированных данных (JSON или разделённых через определённые разделители).`.
37+
2. Описание: `<b>3.8.1</b> Сниппет для обработки, изменения и произвольного вывода структурированных данных (JSON или разделённых через определённые разделители).`.
3838
3. Категория: `Core`.
3939
4. Анализировать DocBlock: `no`.
4040
5. Код сниппета (php): Вставьте содержимое файла `ddGetMultipleField_snippet.php` из архива.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "dd/evolutioncms-snippets-ddgetmultiplefield",
33
"type": "modxevo-snippet",
4-
"version": "3.8.0",
4+
"version": "3.8.1",
55
"description": "A snippet for processing, manipulations and custom output structured data (JSON or separated by delimiters strings).",
66
"keywords": [
77
"modx",

ddGetMultipleField_snippet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* ddGetMultipleField
4-
* @version 3.8 (2022-06-04)
4+
* @version 3.8.1 (2022-06-09)
55
*
66
* @see README.md
77
*

src/Snippet.php

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class Snippet extends \DDTools\Snippet {
55
protected
6-
$version = '3.8.0',
6+
$version = '3.8.1',
77

88
$params = [
99
//Defaults
@@ -236,7 +236,7 @@ protected function prepareParams($params = []){
236236

237237
/**
238238
* run
239-
* @version 1.6.1 (2022-06-04)
239+
* @version 1.6.2 (2022-06-09)
240240
*
241241
* @return {string}
242242
*/
@@ -535,27 +535,6 @@ function(){
535535
$this->params->outputFormat == 'html' ||
536536
$this->params->outputFormat == 'htmlarray'
537537
){
538-
if (
539-
//Если шаблоны колонок заданы
540-
!empty($this->params->colTpl) &&
541-
//Но их не хватает
542-
(
543-
$temp =
544-
count(array_values($data)[0]) -
545-
count($this->params->colTpl)
546-
) > 0
547-
){
548-
//Дозабьём недостающие последним
549-
$this->params->colTpl = array_merge(
550-
$this->params->colTpl,
551-
array_fill(
552-
$temp - 1,
553-
$temp,
554-
$this->params->colTpl[count($this->params->colTpl) - 1]
555-
)
556-
);
557-
}
558-
559538
$rowIndex = 0;
560539

561540
//Перебираем строки
@@ -602,7 +581,13 @@ function(){
602581
]);
603582
}
604583

605-
//If template for the column exists
584+
//If template for this column is not set
585+
if (!isset($this->params->colTpl[$columnIndex])){
586+
//Use previous
587+
$this->params->colTpl[$columnIndex] = $this->params->colTpl[$columnIndex - 1];
588+
}
589+
590+
//If template for the column is needed
606591
if (!empty($this->params->colTpl[$columnIndex])){
607592
$columnValue = \ddTools::parseText([
608593
'text' => $this->params->colTpl[$columnIndex],

0 commit comments

Comments
 (0)