Skip to content
Permalink
Browse files

Add View::disableAutoLayout().

  • Loading branch information...
ADmad committed Nov 1, 2018
1 parent f50a5ac commit 7b54ff897dcf5fcd8654814d109c15f67acb6d38
Showing with 31 additions and 0 deletions.
  1. +14 −0 src/View/View.php
  2. +17 −0 tests/TestCase/View/ViewTest.php
@@ -563,6 +563,20 @@ public function enableAutoLayout($enable = true)
return $this;
}
/**
* Turns off CakePHP's conventional mode of applying layout files.
* Layouts will not be automatically applied to rendered views.
*
* @return $this
*/
public function disableAutoLayout()
{
$this->autoLayout = false;
return $this;
}
/**
* Turns on or off CakePHP's conventional mode of applying layout files.
* On by default. Setting to off means that layouts will not be
@@ -2093,6 +2093,23 @@ public function testAutoLayout()
$this->assertSame($autoLayout, true);
}
/**
* testDisableAutoLayout
*
* @return void
*/
public function testDisableAutoLayout()
{
$this->assertTrue($this->View->isAutoLayoutEnabled());
$result = $this->View->disableAutoLayout();
$this->assertSame($this->View, $result);
$autoLayout = $this->View->isAutoLayoutEnabled();
$this->assertFalse($this->View->isAutoLayoutEnabled());
}
/**
* Test getTheme() and setTheme().
*

0 comments on commit 7b54ff8

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