Skip to content
Permalink
Browse files

Update request usage in View classes.

  • Loading branch information...
markstory committed Oct 6, 2016
1 parent 420508b commit 50e8b21249dded5d8bd0671f8f19015e7309dd22
Showing with 12 additions and 16 deletions.
  1. +2 −2 src/View/JsonView.php
  2. +10 −14 src/View/View.php
@@ -111,8 +111,8 @@ public function render($view = null, $layout = null)
if ($this->viewVars['_jsonp'] === true) {
$jsonpParam = 'callback';
}
if (isset($this->request->query[$jsonpParam])) {
$return = sprintf('%s(%s)', h($this->request->query[$jsonpParam]), $return);
if ($this->request->query($jsonpParam)) {
$return = sprintf('%s(%s)', h($this->request->query($jsonpParam)), $return);
$this->response->type('js');
}
}
@@ -109,7 +109,7 @@ class View implements EventDispatcherInterface
* Current passed params. Passed to View from the creating Controller for convenience.
*
* @var array
* @deprecated 3.1.0 Use `$this->request->params['pass']` instead.
* @deprecated 3.1.0 Use `$this->request->param('pass')` instead.
*/
public $passedArgs = [];
@@ -330,18 +330,14 @@ public function __construct(
}
}
$this->eventManager($eventManager);
$this->request = $request;
$this->response = $response;
$this->request = $request ?: Router::getRequest(true);
$this->response = $response ?: new Response();
if (empty($this->request)) {
$this->request = Router::getRequest(true);
}
if (empty($this->request)) {
$this->request = new Request();
$this->request->base = '';
$this->request->here = $this->request->webroot = '/';
}
if (empty($this->response)) {
$this->response = new Response();
$this->request = new Request([
'base' => '',
'url' => '',
'webroot' => '/'
]);
}
$this->Blocks = new ViewBlock();
$this->initialize();
@@ -1230,8 +1226,8 @@ protected function _getElementFileName($name, $pluginCheck = true)
protected function _getSubPaths($basePath)
{
$paths = [$basePath];
if (!empty($this->request->params['prefix'])) {
$prefixPath = explode('/', $this->request->params['prefix']);
if ($this->request->param('prefix')) {
$prefixPath = explode('/', $this->request->param('prefix'));
$path = '';
foreach ($prefixPath as $prefixPart) {
$path .= Inflector::camelize($prefixPart) . DIRECTORY_SEPARATOR;

0 comments on commit 50e8b21

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