Observed Symptom
No breadcrumb when a node had two terms, and one of the terms was in an excluded vocab.
Expected Behavior
Excluding a vocab at /admin/config/user-interface/custom-breadcrumbs excludes all terms in that vocab for consideration in breadcrumb.
Actual Behavior
All terms are still loaded for consideration. Only further down the chain is the excluded vocab list considered, and if selected term is from excluded vocab, no breadcrumb is generated.
Reason
$term returned from custom_breadcrumbs_taxonomy_node_get_term() in custom_breadcrumbs_taxonomy_node_view() was an excluded term. This resulted in custom_breadcrumbs_taxonomy_generate_breadcrumb() not generating a breadcrumb trail because of term is in an excluded vocab (line 262).
Suggested solution
Exclude terms in excluded vocabs in the db query inside custom_breadcrumbs_taxonomy_node_get_terms(), way before they are considered further downstream. This way, only good candidates are ever passed down. This solution fixes my observed symptom because another term that isn't excluded gets to be used for the breadcrumb.
Comment | File | Size | Author |
---|---|---|---|
#1 | 1929536.diff | 772 bytes | pianomansam |
Comments
Comment #1
pianomansam CreditAttribution: pianomansam commentedPatch for this solution is attached. Note that I keep the validation for excluded vocabs in custom_breadcrumbs_taxonomy_generate_breadcrumb() just in case.