Hansel (from Hansel and Gretel) provides custom breadcrumbs which are build by user defined rules. These rules are independent from the menu system. Rules can have logic switches and can add links to the breadcrumbs.
A sample configuration, somewhat simplified:
start: switch on the first URL argument
if it's "node", goto the rule "node"
if it's "user", goto the rule "user"
node: switch on node type
if it's "news", goto the rule "news"
for all other types, add a link to the node
news: add a link to the news section and goto rule "node_link"
node_link: add a link to the node (on the current page)
user: add a link to /user
This configuration will generate the breadcrumbs "news > newsitem" for the path "node/123" (the real path is used, not the alias).
Provided switch types:
* Url argument
* Node id
* Node type
Provided breadcrumb actions:
* Add single link
* Add link to node
* Add link to user
* Add term path (after enabling the hansel_taxonomy module)
Other features:
* Rules can be organized in a hierarchical structure.
* Possible to leave breadcrumbs as is for specific sections.
* Other modules can add switch types and breadcrumb actions by implementing the hansel_switch_types and hansel_action_types hooks.
* An import / export module is included.
* Test functionality is available where you can see which steps are executed to get the actual breadcrumbs for a given path.
Hansel was built with the following problems in mind:
1. Nodes which does not have a menu item doesn't have correct breadcrumbs.
2. Nodes from a specific type (like "news"), which are part of the news section, cannot have the section in the breadcrumbs.
3. Breadcrumbs should be the same for tabs like /edit.
4. When using domains, it's not possible to start with the domain instead of "Home".
5. Unable to decide if "Home" is added as the first element.
None of the currently available modules provides completely customizable breadcrumbs.
* Custom Breadcrumbs 1.0 allows you to locate nodes per type under a menu-item. This solves the news section issue from the example above, but does not allow full control over your breadcrumbs.
* Custom Breadcrumbs 2.0 beta currently offers the most control over your breadcrumbs. This module however uses a completely different approach. It solves the breadcrumb issues per issue, while Hansel was designed to solve all issues with minimal functionality. Hansel solves all 5 cases from the list above, while Custom Breadcrumbs only solves 1 and 2.
* Menu breadcrumbs allows you to not always use the Navigation menu to create breadcrumbs. It does not solve any of the issues above.
* Taxonomy breadcrumbs allows you to add the termpath to the node and taxonomy pages. This can solve issue 1 and 2, but only if those always have taxonomy terms added to it.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | hansel.tar_.gz | 19.97 KB | mauritsl |
| #1 | hansel.tar_.gz | 14.18 KB | mauritsl |
| #1 | hansel.png | 48.01 KB | mauritsl |
Comments
Comment #1
mauritsl commentedAttached tarball and screenshot.
Comment #2
mauritsl commentedComment #3
avpadernoHello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review your code, pointing out what needs to be changed.
As per CVS application requirements, you should compare the proposed module with the existing solutions.
Comment #4
mauritsl commentedAs per CVS application requirements, you should compare the proposed module with the existing solutions.The module is compared against the currently available breadcrumb modules in the last paragraph (original post). Does it need to be expanded?
Comment #5
mauritsl commentedAny progress yet reviewing this module?
Comment #6
avpadernoComment #7
johnalbinYeah, I think that bit does need further explanation. I don't even understand that last sentence. And how does Hansel's "minimal functionality" compare with CB's "different approach"? I'm not familiar with the 2.x version of CB.
As for the use cases…
Since CB and Hansel can both do #1 and #2 in your list, I'll skip over them.
#3 is a bug in core. :-p But a fix in contrib would be awesome!
#4 Domain Access aware? Is this limited to just swapping the "home" link or is other DA-related manipulation possible?
#5 this is more theme-related, but sometimes themers don't know how to do this.
The module sounds very promising, but I do think clearing up the comparison with Custom Breadcrumbs will make this easier to review.
Comment #8
mauritsl commentedThanks for the feedback, and apologies for the late reply due to the Easter weekend.
I agree that the "solves issues per issue" thing needs more explanation. Issues are solved by several functions and hook implementations;
* custom_breadcrumbs implements an init hook to replace the "home" element
* custom_breadcrumbs_paths implements nodeapi to replace paths for node pages, a views_pre_render hook for views pages and an init hook for other paths
* custom_breadcrumbs_panels implements ctools_render_alter hook to alter breadcrumbs on panels
* custom_breadcrumbs_taxonomy do for form_taxonomy_form_term_alter, views_pre_render and nodeapi
* custom_breadcrumbs_views do for views_pre_render
All those implementations fixes one issue. Hansel, however, uses only one implementation of the registry_alter hook which overrules the whole breadcrumb (except the theming, it's still passed to the theme's theme_breadcrumb implementation). That's what I called the "minimal functionality".
That also has a 'weakness'. Hansel is not very strong at altering your breadcrumbs at some places, but is designed to provide custom breadcrumbs for all pages. It does however have the possibility to leave the breadcrumbs as is on some places (for example the admin), but that is always valid for all pages within the admin. This is also a very important difference between Hansel and Custom breadcrumbs since it reflects a different usecase.
#4 Domain Access aware? Is this limited to just swapping the "home" link or is other DA-related manipulation possible?Currently this is limited to add a link to the current domain. You can place that link anywhere in your breadcrumbs, but at the beginning is usual indeed. Any other DA-related manipulation is not (yet) supported. My idea's are somewhat limited here.. What else would you do with your breadcrumbs in relation to DA?
Comment #9
mauritsl commentedI have created a new version for Hansel. Changes are:
* Added README.txt (was missing).
* Added some docblocks above functions.
* Added hansel.hooks.inc with hook documentation.
* Added switches on domain id and subdomain to the hansel_domain module.
Have someone tried the module and / or did some code review yet? I don't want to get impatient or so, but I'm already waiting three weeks for a review..
Comment #10
bertboerland commentedsubscribing. a review would be appriciated though ;-)
Comment #11
dave reid@mauritsl: I read this and thought of Custom Breadcrumbs too. Have you already filed an issue for that module asking what they thought of this idea and if it could fill a gap in functionality? If you did and could link to it that would be great. We generally like to encourage coordination and cooperation over duplication in our community, but if the Custom Breadcrumb maintainer(s) declined your feature, I think it would be fine to proceed with this application.
Comment #12
mauritsl commentedThanks for the feedback. I have created a new issue: #771662: Flowchart way of generating breadcrumbs
Comment #13
eelkeblokSubscribing
Comment #14
shderuiterSubscribing
Comment #15
killes@www.drop.org commentedSo, I've had a look at the code and the author seems to know what he is doing (although he could comment his code better ;).
While it is desirable to not duplicate things, this is not really duplication as custom breadcrumbs seems to work differently.
While it might be possible to merge both efforts, it might not be the easiest thing to do.
IMO we shouldn't let this issue linger longer and enable Maurits to contribute to Drupal.
Comment #16
avpadernoThank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank all the dedicated reviewers as well.
Comment #17
mauritsl commentedThanks @killes and @kiamlaluno :-)
I will add a project page and a release one of these days.
Comment #20
avpaderno