diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php index 9e0bafb91..1b7243928 100644 --- a/lib/Cake/View/View.php +++ b/lib/Cake/View/View.php @@ -636,11 +636,11 @@ class View extends Object { * empty or undefined '' will be returned. * * @param string $name Name of the block - * @return The block content or '' if the block does not exist. + * @return string The block content or $default if the block does not exist. * @see ViewBlock::get() */ - public function fetch($name) { - return $this->Blocks->get($name); + public function fetch($name, $default = '') { + return $this->Blocks->get($name, $default); } /** diff --git a/lib/Cake/View/ViewBlock.php b/lib/Cake/View/ViewBlock.php index 98b16d7fe..baf08ad21 100644 --- a/lib/Cake/View/ViewBlock.php +++ b/lib/Cake/View/ViewBlock.php @@ -119,11 +119,11 @@ class ViewBlock { * Get the content for a block. * * @param string $name Name of the block - * @return The block content or '' if the block does not exist. + * @return string The block content or $default if the block does not exist. */ - public function get($name) { + public function get($name, $default = '') { if (!isset($this->_blocks[$name])) { - return ''; + return $default; } return $this->_blocks[$name]; }