Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Based on simple example.
decorate__admin_build_views_export__()
How I can remove the link from the last element?
Comment | File | Size | Author |
---|---|---|---|
#8 | crumbs-919166.patch | 2.61 KB | kenorb |
Comments
Comment #1
donquixote CreditAttribution: donquixote commentedZen-based themes contain a setting that allows to configure the display of the last element.
You could also write your own implementation of theme_breadcrumb to do the same.
I am quite undecided if I should implement any of this in crumbs itself. I don't want to conflict with themes.
Maybe decorateTrail would be a good place?
I don't think the function you mention should do the job, because at that moment you don't know if you are dealing with the last item or not.
Do you always want the last item to be not a link, or just in specific cases?
Comment #2
kenorb CreditAttribution: kenorb commentedCurrently I don't need it, but consider to implement that for specific cases.
Comment #3
kenorb CreditAttribution: kenorb commentedComment #4
kenorb CreditAttribution: kenorb commentedSome related topics:
#117528: Unlinked breadcrumb
#264356: Make breadcrumb entry *not* a link?
#492724: 'Force the active trail' removes appended title from breadcrumb
http://drupal.org/node/103174
http://drupal.org/node/103174#comment-1756386
Comment #5
kenorb CreditAttribution: kenorb commentedYes, I need this.
This will do workaround for: #920510: Support $_GET parameters for search functionality.
Comment #6
kenorb CreditAttribution: kenorb commentedProbably this could be done by pre-process function before the rendering. I'll have a look.
To do this, I need following solutions or the right directions:
1.
New property in $item, i.e.: $item->link (bool).
Then in the class you can specify:
to disable the link (by default: TRUE).
2.
How I can determine inside the class on which element currently I am.
I.e.:
doc_search/all/1234?s=English
on: 'doc_search/all' - 2nd crumb of total 3
Or in other words, if you do: '$item->link = FALSE;' in current class, how do I know which element it's in the rendered form?
Then I'd be able to remove the link tags from rendered breadcrumb based on position and settings programatically.
Comment #7
kenorb CreditAttribution: kenorb commentedNo, it's even simpler.
Where $item->link(); returns the link.
Lets create method $item->plain(); when specified crumb has $item->link = FALSE;?
Comment #8
kenorb CreditAttribution: kenorb commentedTested with following method:
'Search' item is not link anymore.
Fixes as well: #921786: Empty last "active" crumb when trying to remove the last element,
so link() returns NULL, if the title or path is empty.
I'm not sure about class names, you can change them as you prefer.
Comment #9
kenorb CreditAttribution: kenorb commentedhttp://drupal.org/project/crumbs_plus