From 8a8d2697d1461cac01c146f1f68dc239d464440f Mon Sep 17 00:00:00 2001 From: Mark Oberemk Date: Tue, 11 Mar 2014 10:37:47 -0400 Subject: [PATCH] Allow chaining in the addCrumb method For convenience I think it might be valuable to allow addCrumb (and possibly other similar functions) to return $this to permit chained calls such as this: $this->Html->addCrumb('Admin', '/admin')->addCrumb('Blogs', '/admin/users')->addCrumb('Add'); as opposed to the considerably more verbose version that needs to be used now: $this->Html->addCrumb('Admin', '/admin'); $this->Html->addCrumb('Blogs', '/admin/users'); $this->Html->addCrumb('Add'); I'm not sure if this violates some API conventions for helpers but it does seem rather more convenient to work with to me. --- lib/Cake/View/Helper/HtmlHelper.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index 6ce3cfafa..454514dc1 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -180,6 +180,7 @@ class HtmlHelper extends AppHelper { */ public function addCrumb($name, $link = null, $options = null) { $this->_crumbs[] = array($name, $link, $options); + return $this; } /**