mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
updating scaffold view handling
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6181 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
34fb530de5
commit
9f8b4b2cd5
2 changed files with 15 additions and 18 deletions
|
@ -185,9 +185,11 @@ class Scaffold extends Object {
|
|||
$associations = $this->__associations();
|
||||
|
||||
$this->controller->set(compact('modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
|
||||
'singularHumanName', 'pluralHumanName', 'scaffoldFields', 'associations'));
|
||||
'singularHumanName', 'pluralHumanName', 'scaffoldFields', 'associations'));
|
||||
|
||||
$this->controller->view = 'scaffold';
|
||||
if ($this->controller->view && $this->controller->view !== 'Theme') {
|
||||
$this->controller->view = 'scaffold';
|
||||
}
|
||||
$this->__scaffold($params);
|
||||
}
|
||||
/**
|
||||
|
@ -365,21 +367,7 @@ class Scaffold extends Object {
|
|||
* @access private
|
||||
*/
|
||||
function __scaffoldError() {
|
||||
$pathToViewFile = '';
|
||||
|
||||
if (file_exists(APP . 'views' . DS . $this->viewPath . DS . 'scaffolds' . DS. 'scaffold.error.ctp')) {
|
||||
$pathToViewFile = APP . 'views' . DS . $this->viewPath . DS . 'scaffolds' . DS . 'scaffold.error.ctp';
|
||||
} elseif (file_exists(APP . 'views' . DS . $this->viewPath . DS . 'scaffolds' . DS. 'scaffold.error.thtml')) {
|
||||
$pathToViewFile = APP . 'views' . DS . $this->viewPath . DS . 'scaffolds' . DS . 'scaffold.error.thtml';
|
||||
} elseif (file_exists(APP . 'views' . DS . 'scaffolds' . DS . 'scaffold.error.ctp')) {
|
||||
$pathToViewFile = APP . 'views' . DS . 'scaffolds' . DS . 'scaffold.error.ctp';
|
||||
} elseif (file_exists(APP . 'views' . DS . 'scaffolds' . DS . 'scaffold.error.thtml')) {
|
||||
$pathToViewFile = APP . 'views' . DS . 'scaffolds' . DS . 'scaffold.error.thtml';
|
||||
} else {
|
||||
$pathToViewFile = LIBS . 'view' . DS . 'templates' . DS . 'errors' . DS . 'scaffold_error.ctp';
|
||||
}
|
||||
|
||||
return $this->controller->render($this->action, $this->layout, $pathToViewFile);
|
||||
return $this->controller->render('error', $this->layout);
|
||||
}
|
||||
/**
|
||||
* When methods are now present in a controller
|
||||
|
@ -520,6 +508,10 @@ class ScaffoldView extends ThemeView {
|
|||
}
|
||||
}
|
||||
|
||||
if ($name === 'scaffolds' . DS . $subDir . 'error') {
|
||||
return LIBS . 'view' . DS . 'errors' . DS . 'scaffold_error.ctp';
|
||||
}
|
||||
|
||||
return $this->_missingView($paths[0] . $name . $this->ext, 'missingView');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class TestScaffoldView extends ScaffoldView {
|
|||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class ScaffoldTest extends CakeTestCase {
|
||||
class ScaffoldViewTest extends CakeTestCase {
|
||||
|
||||
var $fixtures = array('core.post');
|
||||
|
||||
|
@ -67,6 +67,11 @@ class ScaffoldTest extends CakeTestCase {
|
|||
$result = $ScaffoldView->testGetFilename('index');
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'index.ctp';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
$result = $ScaffoldView->testGetFilename('error');
|
||||
$expected = 'cake' . DS . 'libs' . DS . 'view' . DS . 'errors' . DS . 'scaffold_error.ctp';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Reference in a new issue