Hi, I'd like to open this issue for merging further features in 2.x branch for CB.
We (Eaton, MGN and I) discussed about an API interface for breadcrumbs manipulation, allowing more modules to add taxonomy-breadcrumbs, views-breadcrumbs and anything you can imagine.. waiting for inputs and ideas :)
Comments
Comment #1
MGN commentedI've started working on a few ideas for this and could use some feedback. As Eaton pointed out, each page type essentially requires its own breadcrumb module, implementing whatever approach is necessary to insert a breadcrumb on that page type. I think custom breadcrumbs could serve as the base module that helps to organize and coordinate other breadcrumb modules, which would be packaged with custom_breadcrumbs as dependent submodules. Custom breadcrumbs should provide whatever hooks are needed to organize and coordinate the submodules into a coherent whole.
With coordinated development in one package, it will be easier to make sure all submodules work together and all page types can be handled. To the degree that interface code can be shared, they will be smaller than independent modules and easier to adminster since they are grouped together. Finally, administrators can choose what submodules to install for a particular site.
I've made the following changes to the base custom_breadcrumb module, and have written a views submodule. I am working on a submodule to provide breadcrumbs at specific paths, and then moving on to implementing taxonomy_breadcrumb in this framework. I know there is a lot of interest in breadcrumbs for panels, but I don't use panels. So someone else needs to step up and figure out how to do that. I'll be happy to help, but I can't test it right now.
Proposed modifications to custom_breadcrumbs 6.x-2.x:
custom_breadcrumbs_common_form_elements()function. Submodules could provide their own edit form (or use the base custom_breadcrumbs form and use hook_form_alter to add their specific fields.function custom_breadcrumbs_set_breadcrumb($breadcrumb, $node = NULL), but the submodule would need to decide when its appropriate to call this function, and provide a compatible breadcrumb object.What am I missing? Any alternative approaches? Any input (aside from 'subscribe') would be appreciated.
Comment #2
MGN commentedAnother idea for the custom_breadcrumbs api. Provide a hook that allows a module to register pages for custom_breadcrumbs, then serve the custom breadcrumbs by calling
custom_breadcrumbs_get_breadcrumb($module_name, $page_name). I think the same can be accomplished through theming, but this has the advantage of gathering together all custom breadcrumbs in a consistent interface with breadcrumb trails stored in tables, rather than within individual files.Comment #3
giorgio79 commentedOne more idea: Provide a custom breadcrumb block, so I can display it wherever I want.
Currently this seems to be taken care of (or not) by themes, which I am not very happy with. :)
Comment #4
MGN commentedOther ideas:
To support this, each submodule implements a hook_cb_breadcrumb_info that provides the table, special field, and breadcrumb type (for display), such as:
Custom breadcrumbs can then use this to manage the breadcrumb (load, save, delete...), preventing code duplication in all the submodules and providing a base uniformity of the breadcrumb object.
To load breadcrumbs, custom_breadcrumbs can use a function definition like:
function custom_breadcrumbs_load_breadcrumbs($module, $param = array() ) { ...Where $module is the name of the module implementing hook_cb_breadcrumb_info, and $param is an array of the form 'field' => $value, used to specify the breadcrumbs to load.
For example:
$breadcrumb = custom_breadcrumbs_load_breadcrumbs('custom_breadcrumbs', array('node_type' => $node->type));would be used to load a node-type breadcrumb, while
$breadcrumb = custom_breadcrumbs_load_breadcrumbs('custom_breadcrumbs_views', array('bid' => $bid));would be used to load a views breadcrumb with breadcrumb id $bid. Called without the $param argument, the function would return all breadcrumbs from the submodule's table.
As a starting point to test these ideas and encourage discussion, I've started a 6.x.2.x-dev release. If you choose to test, be careful - its definitely not production yet...but feedback from the adventurous is appreciated.
Comment #5
TimG1 commentedHey Everyone,
I just downloaded and tried custom breadcrumbs for the first time about a week ago and am not all that familiar with it just yet. I'm also not really a programmer and don't know the inner workings of drupal and module development. So, I apologize for my ignorance. =)
The module (v 6.x-1.4) has been working great except for overriding the active menu trail and working with views.
I just tried downloading the latest 6.x-2.x-dev (March 29, 2009 - 05:06) and noticed something that I couldn't do in the 6.x-1.4 version I was using. In 6.x-1.4 I could add multiple custom breadcrumb trails for a given node type. In the 2.x dev version it seems like I can only have one custom breadcrumb per node.
I'm building a site for a college and have node type = "News". I would like to be able to have a different breadcrumb trail for News items that are in the "Alumni" section of the site than in the "Faculty" section of my site.
So, I had some PHP in my custom breadcrumb trail that would test for a string in the URL that got appended in my View. This way I can test for "Alumni" in my URL and show a breadcrumb trail like Home > Alumni > News. And then I can have a second custom breadcrumb that will test for "Faculty" and the breadcrumb would be Home > Faculty > News.
With 2.x dev it seems like I can only have one custom breadcrumb trail per node type. Did I overlook something?
Thanks!
-Tim
Comment #6
MGN commentedYou are absolutely right...looks like I butchered that valuable feature. It will be corrected shortly...
Thanks for testing
Comment #7
KoCo commentedPanels integration would be nice too.
Comment #8
Bears commentedI love this module!
But I miss one thing:
The ability to use tokens and wildcards when specifying a path where the breadcrumb is to be set, e.g. if one wants to set a breadcrumb for the path
user/[uid]/bookmarksoruser/*/bookmarks.Keep up the good work! It sure is appreciated! :)
Comment #9
MGN commentedClosing now that cb 2.0 has an official beta release. New feature requests should have their own issues now.