diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2013-11-18 07:02:19 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2013-11-18 07:02:19 +0400 |
commit | 9060f0180cb935efd1925942d3a8ce1cf309459a (patch) | |
tree | b474d8758f3b45063e4bd430f5daa028b369c879 /core/Plugin/Controller.php | |
parent | 4658d92891093982d979e7ec8343ee4ccc510a38 (diff) |
getting rid of the fetch parameter
Diffstat (limited to 'core/Plugin/Controller.php')
-rw-r--r-- | core/Plugin/Controller.php | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/core/Plugin/Controller.php b/core/Plugin/Controller.php index 0f50fd3ce4..9aab2584b3 100644 --- a/core/Plugin/Controller.php +++ b/core/Plugin/Controller.php @@ -56,7 +56,7 @@ use Piwik\API\Proxy; * { * $view = new View("@MyPlugin/index.twig"); * // ... setup view ... - * echo $view->render(); + * return $view->render(); * } * } * @@ -193,29 +193,22 @@ abstract class Controller * A helper method that renders a view either to the screen or to a string. * * @param ViewInterface $view The view to render. - * @param bool $fetch If true, the result is returned as a string. If false, - * the rendered string is echo'd to the screen. * @return string|void * @api */ - protected function renderView(ViewInterface $view, $fetch = false) + protected function renderView(ViewInterface $view) { - $rendered = $view->render(); - if ($fetch) { - return $rendered; - } - echo $rendered; + return $view->render(); } /** * Convenience method that creates and renders a ViewDataTable for a API method. * * @param string $apiAction The name of the API action (eg, getResolution). - * @param bool $fetch If true, the result is returned, if false it is echo'd. * @throws \Exception - * @return string|null See $fetch. + * @return string */ - protected function renderReport($apiAction, $fetch = true) + protected function renderReport($apiAction) { $pluginName = $this->pluginName; @@ -231,11 +224,7 @@ abstract class Controller $view = ViewDataTableFactory::build(null, $apiAction); $rendered = $view->render(); - if ($fetch) { - return $rendered; - } else { - echo $rendered; - } + return $rendered; } /** |