Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added ability to set default view block content

  • Loading branch information...
commit 6d98069f1349b6173ebb1b2476bf3417c05715e6 1 parent 07c5102
@tigrang tigrang authored
Showing with 6 additions and 6 deletions.
  1. +3 −3 lib/Cake/View/View.php
  2. +3 −3 lib/Cake/View/ViewBlock.php
View
6 lib/Cake/View/View.php
@@ -636,11 +636,11 @@ public function assign($name, $value) {
* 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);
}
/**
View
6 lib/Cake/View/ViewBlock.php
@@ -119,11 +119,11 @@ public function set($name, $value) {
* 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];
}
Please sign in to comment.
Something went wrong with that request. Please try again.