diff options
Diffstat (limited to 'core/DataTable/Renderer/Json.php')
-rw-r--r-- | core/DataTable/Renderer/Json.php | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/core/DataTable/Renderer/Json.php b/core/DataTable/Renderer/Json.php index 16fee39e2c..812eb4e76a 100644 --- a/core/DataTable/Renderer/Json.php +++ b/core/DataTable/Renderer/Json.php @@ -54,12 +54,23 @@ class Piwik_DataTable_Renderer_Json extends Piwik_DataTable_Renderer */ protected function renderTable($table) { - $renderer = new Piwik_DataTable_Renderer_Php(); - $renderer->setTable($table); - $renderer->setRenderSubTables($this->isRenderSubtables()); - $renderer->setSerialize(false); - $renderer->setHideIdSubDatableFromResponse($this->hideIdSubDatatable); - $array = $renderer->flatRender(); + if (is_array($table)) + { + $array = $table; + if (self::shouldWrapArrayBeforeRendering($array)) + { + $array = array($array); + } + } + else + { + $renderer = new Piwik_DataTable_Renderer_Php(); + $renderer->setTable($table); + $renderer->setRenderSubTables($this->isRenderSubtables()); + $renderer->setSerialize(false); + $renderer->setHideIdSubDatableFromResponse($this->hideIdSubDatatable); + $array = $renderer->flatRender(); + } if(!is_array($array)) { |