Navigation Menu

Skip to content

Commit

Permalink
Add View::disableAutoLayout().
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Nov 1, 2018
1 parent f50a5ac commit 7b54ff8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/View/View.php
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions tests/TestCase/View/ViewTest.php
Expand Up @@ -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().
*
Expand Down

0 comments on commit 7b54ff8

Please sign in to comment.