Skip to content
Permalink
Browse files

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.
  • Loading branch information...
moberemk authored and markstory committed Mar 11, 2014
1 parent 7419ac3 commit d5721f10fdada2a17dbeea60e4e9cb57d8a94df6
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/Cake/View/Helper/HtmlHelper.php
@@ -180,6 +180,7 @@ public function __construct(View $View, $settings = array()) {
*/
public function addCrumb($name, $link = null, $options = null) {
$this->_crumbs[] = array($name, $link, $options);
return $this;
}
/**

0 comments on commit d5721f1

Please sign in to comment.
You can’t perform that action at this time.