Closed (fixed)
Project:
Easy Breadcrumb
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
28 Jul 2016 at 11:02 UTC
Updated:
23 Sep 2022 at 16:53 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
Algeron commentedAnd here it is.
Could probably be hidden on non-multilingual sites using an extra check.
Comment #3
greg boggsThanks Algeron! Great feature!
I'll be adding this shortly with some minor edits to your patch. So, your code will just work in the next release of easy breadcrumb. Most likely, I will enable this feature by default on module install, but if you already have the module, you'll need to check the box when upgrading.
Comment #4
heddnBump
Comment #6
greg boggsComment #7
heddnThe patch from #2 doesn't actually work. I've just applied it and the ordering of things assumes that the langcode is in a set location in the breadcrumb. For me, that isn't in the 1st slot. It is in the 0th slot.
Next, it also assumes that everything is a string. Which isn't true. For me, me path includes the user profile. So it returns a user object and throws:
Warning: strtoupper() expects parameter 1 to be string, array given in Drupal\easy_breadcrumb\EasyBreadcrumbBuilder->build() (line 211 of modules/contrib/easy_breadcrumb/src/EasyBreadcrumbBuilder.php).Comment #8
greg boggs*sigh* Thanks for the update Lucas. Is your language in 0 because you do not have home in your crumbs? We could fix that by placing the language check above the home crumb code.
Comment #9
heddnYup, I don't print the homepage.
The second issue is that my URL path for the node is /blog/lucas-hedding/blog-post-title-here. And my pauthauto for users is blog/[user:field_first_name]-[user:field_last_name]. So the 2nd segment of the url actually is a loaded user object. The last part (/blog) is a views listing page.
Comment #10
greg boggsI understand the problem. I believe the fix is to move the code into the link generation instead of trying to sort it out at the end. I'm working on this now.
Comment #12
greg boggsHi Lucas,
I pushed a new version of this feature to the dev branch of Easy Breadcrumb. I've moved the language remover to the top of the breadcrumb generation so it should avoid all the problems you've found. Can you grab the latest dev release and test again?
Do remember to clear cache once you update because the cache is pretty sticky with these crumbs.
git clone --branch 8.x-1.x https://git.drupal.org/project/easy_breadcrumb.git
~Greg
Comment #13
heddnI'd suggest using Unicode::strtolower on the breadcrumb title. And you only need to pass the title through strtolower since the langcode from drupal is always lowercase.
Testing commit from #12 now.
Comment #14
heddn#12 works. Some suggestions for future improvements are mentioned in #13. Not sure if you want to mark this fixed or have more testing done.
Comment #16
greg boggsYour suggestions in 13 have been made, tested, and pushed. I am doing this now rather than later because I didn't test your use case before publishing the first version of the patch. This version is much better than what's going to be live.
Comment #17
heddnIn that last commit I don't see an import for Unicode. Are you sure it works?
Comment #18
greg boggsI believe the import is on line 5 already. :) I really, really do appreciate the second set of eyes though. With 1000 people now using the module in D8, I want to get it right.
Comment #19
greg boggsComment #21
yogeyoge commentedLanguage code was visible even after the checkbox Make the language path prefix a segment was not checked. I am attaching a patch which removes the language code when the checkbox is unchecked and adds the language code when checked.
Comment #22
greg boggsYoge, thanks for posting. Have you tried the latest dev branch of Easy Breadcrumb? This should have fixed the issue:
https://www.drupal.org/project/easy_breadcrumb/issues/3233013
We can't just remove the check for current language because then all non-translated pages will be missing a breadcrumb.
If there is still a bug, please post in 3233013 instead of a 6 year old issue.