Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add accessor method for View::autoLayout
  • Loading branch information
ADmad committed Jun 18, 2015
1 parent 28f459e commit 00d50de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Controller/Controller.php
Expand Up @@ -558,7 +558,7 @@ public function render($view = null, $layout = null)
}

if (!empty($this->request->params['bare'])) {
$this->_view->autoLayout = false;
$this->_view->autoLayout(false);
}

$viewClass = $this->viewClass;
Expand Down
17 changes: 17 additions & 0 deletions src/View/View.php
Expand Up @@ -366,6 +366,23 @@ public function layoutPath($path = null)
$this->layoutPath = $path;
}

/**
* Turns on or off CakePHP's conventional mode of applying layout files.
* On by default. Setting to off means that layouts will not be
* automatically applied to rendered views.
*
* @param string $autoLayout Boolean to turn on/off. If null returns current value.
* @return bool|void
*/
public function autoLayout(bool $autoLayout = null)
{
if ($var === null) {
return $this->autoLayout;
}

$this->layoutPath = $autoLayout;
}

/**
* Renders a piece of PHP with provided parameters and returns HTML, XML, or any other string.
*
Expand Down

0 comments on commit 00d50de

Please sign in to comment.