diff options
Diffstat (limited to 'core/DataTable/Renderer/Php.php')
-rw-r--r-- | core/DataTable/Renderer/Php.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/core/DataTable/Renderer/Php.php b/core/DataTable/Renderer/Php.php index 65229d6767..5bcb861950 100644 --- a/core/DataTable/Renderer/Php.php +++ b/core/DataTable/Renderer/Php.php @@ -122,9 +122,14 @@ class Php extends Renderer } elseif ($dataTable instanceof Simple) { $flatArray = $this->renderSimpleTable($dataTable); + reset($flatArray); + $firstKey = key($flatArray); + // if we return only one numeric value then we print out the result in a simple <result> tag // keep it simple! - if (count($flatArray) == 1) { + if (count($flatArray) == 1 + && $firstKey !== DataTable\Row::COMPARISONS_METADATA_NAME + ) { $flatArray = current($flatArray); } } // A normal DataTable needs to be handled specifically @@ -206,6 +211,10 @@ class Php extends Renderer $newRow['issummaryrow'] = true; } + if (isset($newRow['metadata'][DataTable\Row::COMPARISONS_METADATA_NAME])) { + $newRow['metadata'][DataTable\Row::COMPARISONS_METADATA_NAME] = $row->getComparisons(); + } + $subTable = $row->getSubtable(); if ($this->isRenderSubtables() && $subTable @@ -245,6 +254,12 @@ class Php extends Renderer foreach ($row->getColumns() as $columnName => $columnValue) { $array[$columnName] = $columnValue; } + + $comparisons = $row->getComparisons(); + if (!empty($comparisons)) { + $array[DataTable\Row::COMPARISONS_METADATA_NAME] = $comparisons; + } + return $array; } } |