Download & Extend

Breadcrumbs specific to forum wrapper pages (by template?)

Project:Custom breadcrumbs
Version:6.x-2.x-dev
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hello all

Thanks for all your work on this, MGN. I'm really appreciating this module at the moment, and so far it's produced nearly everything I've thought of asking it to do :-)

Here's my latest puzzle:

I'm currently using core Forum. I'm using Custom Breadcrumbs to set the breadcrumbs for the individual thread pages. But what about the wrapper pages which come from forums.tpl.php? As the breadcrumbs are called from page.tpl.php, I can't just tweak forums.tpl.php. And as these pages aren't nodes (i.i.u.c.), I can't tell C B to recognise them by their node type.

Is there a way for Custom Breadcrumbs to recognise "This is a page using [template]"? (in this case forums.tpl.php).

Or, if I do this by path, choosing the /forum path, can you give me any clues about what my custom setup should look like? as it's not working yet.

=

On the /forum page I want this:
Home (linked) > Forum (not linked)

On the subforum pages I want this:
Home (linked) > Forum (linked) > Name-of-Subforum (not linked)

I'm not sure if that would run me into this issue - but I haven't even got that far yet.

(This structure differs slightly from what I'm using on the individual threads, too - but I imagine that would just mean I weight higher the existing custom breadcrumb for forum nodes.)

=

I've just installed the dev build from 3 Aug 2009, and I tried the following using Custom Breadcrumb for Path:

Specific Path:
forum/main-discussion

Breadcrumbs Visibility blank.

Titles:
Forums
Breadcrumb test

Paths:
forum

Saved that, reloaded the /main-discussion page, but it hasn't changed the breadcrumb at all, so maybe I'm doing something completely wrong...?

Should I be using CB for Paths, anyway? or would it make more sense here to use CB for Taxonomy?

=

(As an aside: the default for these forum-wrapper pages, without invoking Custom Breadcrumbs on them at all, is almost what I want. It just doesn't include the page title. But I don't want to include page title as a global setting, such as by Menu Breadcrumb's "Append page title to breadcrumb" tickbox, because of other pages where I don't want to include the page title.

I imagine presumably there is a way to look up which template is being called, so my fallback plan if CB can't do it yet is to insert a conditional clause in my theme_breadcrumb function.)

thanks for any advice

Jennifer

Comments

#1

Does CB have any sort of API that a module can call to hook into it? Advanced Forum does a drupal_set_breadcrumb($breadcrumb); for the forum pages. If CB has an API where I could send $breadcrumb in to be modified beforehand, I'd be happy to add it in.

Michelle

#2

Category:support request» feature request

@Michelle, I did write a hook for menu pages but haven't released it yet.

I wrote it as a separate cb sub module, custom_breadcrumbs_menu, but wasn't sure how much use it would get. I agree that forum pages (and other modules that don't provide a convenient hook to access the page before rendering) would be a good use for this, because none of the other custom breadcrumbs can provide a breadcrumb for callback functions. Just not sure how many developers would want to make custom breadcrumb compatible modules. Still, I am willing to release it and support it if there is interest.

#3

I don't personally have a need for it as I'm fine with the forum breadcrumbs as is. But I'd be willing to support it in AF if you let me know what code you need in there. :)

Michelle

#4

In case anyone finds this in a search later - I did solve my original problem, but by selecting node pages to not have the page title rather than wrapper pages to have the page title. Writeup here.

So personally I don't need this as a feature request for the moment - but I suspect it's the kind of thing likely to be useful to someone some time (even me maybe :-) ). So I'll leave it open for assessment in the light of all the other priorities etc...

#5

I've now committed a new submodule called custom_breadcrumbsapi that can be used to provide custom breadcrumbs for module pages not otherwise covered by custom breadcrumbs.

The details are specified in README.txt, but here is the relevant excerpt:

+ custom_breadcrumbsapi provides a simple api that allows custom breadcrumbs to be defined for module pages implementing the api. Module developers need to provide a modulename_custom_breadcrumbsapi() function that returns an array containing the names of the module pages for which custom breadcrumbs may be defined.

The following is an example that could be used with the forum module.

/**
* Implementation of hook_custom_breadcrumbsapi().
* Allow custom breadcrumbs for the following module pages.
*/
function forum_custom_breadcrumbsapi() {
return array('forum listing');
}

Then, in the callback functions for each of those pages, the following line must be inserted within the function (preferably after defining $breadcrumb but before setting the breadcrumb):

drupal_alter('breadcrumb', $breadcrumb, 'module_page_name');

Continuing with the forum module example, 'module_page_name' would be replaced with 'forum listing'.

I think its fairly unobtrusive: 1 hook function to indicate the module wants to play, and a line (which could actually be used by any module) to allow custom breadcrumbs to set the breadcrumb on the page.

@Michelle, let me know what you think of this looking at it from the perspective of a developer.

So far I've tried this out with the core forum and blog modules and its worked well.

#6

I filed an issue for it so I don't forget: #571114: Integrate with custom breadcrumbs

I'm not quite getting it from the description. Will need to play around with it and see.

Michelle

#7

I'll save you the trouble and post a patch at #571114: Integrate with custom breadcrumbs

#8

Status:active» fixed

Is there a way for Custom Breadcrumbs to recognise "This is a page using [template]"? (in this case forums.tpl.php).

The answer is yes! Sorry its taken me so long to figure out how, but in the end it was relatively easy.

You can now define custom breadcrumbs to be used whenever a theme template is used. You can select from the list of theme templates on the custom breadcrumb for module page form. This list is derived from the theme registry. To provide the breadcrumb, custom_breadcrumbsapi implements moduleName_preprocess. Access to the template variables (through the $variables array) is provided for determining breadcrumb visibility and/or for constructing the breadcrumb using a php snippet (if these options are enabled).

I've just committed the new feature in CVS. With this I have been able to tweak the breadcrumbs on forum, profile, and user pages.

#9

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#10

Thanks, that's great.

nobody click here