Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

improve json/xml output when params contain a single variable #91

Merged
merged 1 commit into from Nov 26, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,11 @@
Changelog
=========

1.1.1
-----

* **2013-11-26**: Improve json/xml output when params contain a single variable

1.0.0-RC3
---------

Expand Down
7 changes: 7 additions & 0 deletions Controller/ContentController.php
Expand Up @@ -90,7 +90,14 @@ public function indexAction(Request $request, $contentDocument, $contentTemplate
protected function renderResponse($contentTemplate, $params)
{
if ($this->viewHandler) {
if (1 === count($params)) {
$templateVar = key($params);
$params = reset($params);
}
$view = new View($params);
if (isset($templateVar)) {
$view->setTemplateVar($templateVar);
}
$view->setTemplate($contentTemplate);

return $this->viewHandler->handle($view);
Expand Down