Skip Navigation

Breadcrumbs API overhauled

March 2, 2010 at 2:12 pm
By Matt Ryan

We've overhauled the API for dealing with breadcrumbs. These changes will, hopefully, make dealing with breadcrumbs significantly easier – particularly when developing modules that are more complex than a single class.

The new API centers around a breadcrumbs object. The template instantiates this object and passes a reference to the modules via $module->set_crumbs(). Modules then can use the convenience function $this->_add_crumb($name, $url) to add a crumb to this object, or if they want to do something more sophisticated (like passing it along to another class or peeking at the contents of the object) they can access it by calling $this->_get_crumbs().

In the meantime, calling $this->parent->add_crumb() – which was the old way of doing this – will still work. However, because this change is part of a long-term effort to remove all dependencies that modules have on the template, we encourage Reason developers to update any code to call $this->_add_crumb() instead.

We hope in the not-too-distant future to entirely deprecate references to the template by modules. This will help make modules genuinely modular (that is, they will not be tightly bound to the template.)

Add a comment

Name*
Comment*
The following fields are not to be filled out. Skip to Submit Button.
Not Comment
(This is here to trap robots. Don't put any text here.)
Not URL
(This is here to trap robots. Don't put any text here.)
Avoid
(This is here to trap robots. Don't put any text here.)