Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. //On my plugin controller in "plugins/IMApi/Controller/ApiController.php":
  2.  
  3.     public function initialize() {
  4.         parent::initialize();
  5.         $this->viewBuilder()->className('IMApi.Api');
  6.     }
  7.  
  8.  
  9.  
  10.  
  11. // My custom view in "plugins/IMApi/View/ApiView.php"
  12.  
  13. <?php
  14. namespace IMApi\View;
  15. use Cake\View\View;
  16.  
  17. class ApiView extends View {
  18.     public $layout = 'api';
  19.  
  20.     public function initialize() {
  21.         parent::initialize();
  22.  
  23.         $this->response->type('json');
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement