Skip to content
Permalink
Browse files

add _jsonOptions

  • Loading branch information...
slywalker committed Nov 20, 2013
1 parent 86f08c9 commit 03aa24f61169b3c34033c73b871e9c97aaf25570
Showing with 7 additions and 2 deletions.
  1. +7 −2 Cake/View/JsonView.php
@@ -146,11 +146,16 @@ protected function _serialize($serialize) {
$data = isset($this->viewVars[$serialize]) ? $this->viewVars[$serialize] : null;
}
$jsonOptions = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT;
if (isset($this->viewVars['_jsonOptions'])) {
$jsonOptions = $this->viewVars['_jsonOptions'];
}
if (Configure::read('debug')) {
return json_encode($data, JSON_PRETTY_PRINT);
return json_encode($data, $jsonOptions | JSON_PRETTY_PRINT);
}
return json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
return json_encode($data, $jsonOptions);
}
}

0 comments on commit 03aa24f

Please sign in to comment.
You can’t perform that action at this time.