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.
This commit is contained in:
Mark Oberemk 2014-03-11 10:37:47 -04:00 committed by mark_story
parent 7419ac35b0
commit d5721f10fd

View file

@ -180,6 +180,7 @@ class HtmlHelper extends AppHelper {
*/
public function addCrumb($name, $link = null, $options = null) {
$this->_crumbs[] = array($name, $link, $options);
return $this;
}
/**