Closed (fixed)
Project:
Crumbs, the Breadcrumbs suite
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Nov 2012 at 15:58 UTC
Updated:
11 Dec 2012 at 14:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
jsacksick commentedComment #2
bojanz commentedCommitted the attached patch (made the second chunk consistent with the first, $uri['path'] instead of $path['path']).
This is important if you want to provide per-vocabulary taxonomy pages.
Also, there is no guarantee that the entity url for a term will stay "taxonomy/term", that's just the default provided by the module.
Comment #3
bojanz commentedOkay, didn't push yet.
We'll want to change:
(There's no need for array_filter() since the value is always TRUE)
Comment #4
bojanz commentedSo maybe this?
Note that we are loading all found terms, which has a performance impact.
A better idea might be to just load the first term, though there is a possibility that the referenced term no longer exists, in which case no url could be returned (do we care about this? Probably not).
Comment #5
donquixote commentedIf you are worried about loading only one term, just put it inside the loop.
Comment #6
donquixote commentedBtw, if anyone wondered about the uncommented stuff in lines 58 - 74:
This is in case we have multiple terms for an entity, and one is the parent of another. In this case, we want to pick the child, not the parent.
This desperately needs a comment. (I won't do it now to not mess around with line numbers until this patch is committed)
I also want to note that we have a lot of hardcoded entity urls in Crumbs. node/%, taxonomy/term/%, etc.
E.g. the entity_uri() in findParent__taxonomy_term_x() will have very limited effectiveness, if the method does not fire in the first place.
The goal is to have some smart detection which plugins should fire for a given path, without trying every plugin on every request. This should be discussed in a follow-up.
Comment #7
jsacksick commentedLoading multiple taxonomy terms is definetly much efficient than loading one by one I'd say.
We should probably fallback on taxonomy/term/tid if $uri returns NULL
Comment #8
donquixote commentedIn 99% we only need the first one. So it is more efficient in this case to load only one. If we do that, we just put it inside the loop to be safe.
For the (!empty($uri)) I have no opinion, maybe you are right.
Comment #9
jsacksick commentedAs a general remark, every crumbs multiplugin implements crumbs_MultiPlugin that only has the describe method, but it seems that every plugin implements a
_findParentPath method(). Is there a reason for that ?We should probably replace every hardcoded node/, user/ etc by entity_uri and use entity_load instead of taxonomy_term_load when needed.
Comment #10
bojanz commentedI agree with #8, loading 1 by 1 is fine, we'll load only 1 in 99.9% of the cases.
If $uri returns NULL, that means the term has no URI of its own, so defaulting to 'taxonomy/term/tid' makes no sense.
No need to rush with fixing other plugins, these are all edge cases, with taxonomy uri just being the most common of them.
I like #5, but since we're supporting NULL uris in the first part, let's do the same in the second part as well.
Comment #11
donquixote commentedI'm happy with #10.
Comment #12
bojanz commentedCommitted. Yay, team! :)