I've two classes with two methods (priority as listed):
1. content_search->decorate__doc_search_content()
2. breadcrumb_doc->decorate()

I want to skip the second one, if the first method was able to create the crumb on specified condition.
Tried: skipInBreadcrumb(), but it removes the whole item.
Is there anything like: skipTheRest ?

Comments

kenorb’s picture

Workaround is to write condition:

if (!$item->title) {
// code
}

But there should be some method as well, to improve the performance, instead of scanning all the rest crumbs. Then the module with low priority has the highest priority, because it overrides the crumb as the last.

donquixote’s picture

In the 2.x branch there is now a method findTitle() that is used instead of the old decorate() method.
The mechanic is more like findParent(), though.

The code for priorities logic has been changed a lot in 2.x, so now the configured order of plugin rules determines which title will be used.
And for performance, the process will stop when all further rules would have a lower priority than the one found.
(Internally, it is top of the list = low weight = high priority, but you don't need to think about that)

donquixote’s picture

Status: Active » Needs review

"needs review" = "probably fixed in 2.x"

In general, after finding a title, crumbs will not continue to look further.
Just make sure to put the rule at the top that has the higher priority.

bojanz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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