SyjNoRender helper
authorArno Renevier <arno@renevier.net>
Wed, 28 Dec 2011 17:10:23 +0000 (18:10 +0100)
committerArno Renevier <arno@renevier.net>
Wed, 28 Dec 2011 17:22:56 +0000 (18:22 +0100)
application/controllers/helpers/SyjApi.php
application/controllers/helpers/SyjNoRender.php [new file with mode: 0644]

index 6016f99..029fe90 100644 (file)
@@ -11,12 +11,7 @@ class Syj_Controller_Action_Helper_SyjApi extends Zend_Controller_Action_Helper_
     protected $_redirect = '';
 
     public function init() {
-        $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
-        $viewRenderer->setNoRender();
-        $layout = Zend_Layout::getMvcInstance();
-        if (null !== $layout) {
-            $layout->disableLayout();
-        }
+        $this->getActionController()->getHelper('SyjNoRender')->disableRender();
     }
 
     public function setContentType($contentType) {
diff --git a/application/controllers/helpers/SyjNoRender.php b/application/controllers/helpers/SyjNoRender.php
new file mode 100644 (file)
index 0000000..df0ef90
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+/*  This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
+    and is published under the AGPL license. */
+
+class Syj_Controller_Action_Helper_SyjNoRender extends Zend_Controller_Action_Helper_Abstract
+{
+
+    public function disableRender() {
+        $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
+        $viewRenderer->setNoRender();
+        $layout = Zend_Layout::getMvcInstance();
+        if (null !== $layout) {
+            $layout->disableLayout();
+        }
+    }
+
+}