Comments

Algeron created an issue. See original summary.

Algeron’s picture

Status: Active » Needs review
StatusFileSize
new3.55 KB
new105.85 KB

And here it is.
Could probably be hidden on non-multilingual sites using an extra check.

greg boggs’s picture

Thanks 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.

heddn’s picture

Bump

  • Greg Boggs committed 8aec66c on 8.x-1.x authored by Algeron
    Issue #2774485 by Algeron: Add option to remove language prefix from...
greg boggs’s picture

Status: Needs review » Fixed
heddn’s picture

Status: Fixed » Needs work

The 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).

greg boggs’s picture

*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.

heddn’s picture

Yup, 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.

greg boggs’s picture

I 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.

  • Greg Boggs committed 69d8be7 on 8.x-1.x
    Issue #2774485 by Algeron, Greg Boggs: Move option to remove language...
greg boggs’s picture

Hi 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

heddn’s picture

Status: Needs work » Needs review

I'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.

heddn’s picture

#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.

  • Greg Boggs committed 07500c8 on 8.x-1.x authored by Algeron
    Issue #2774485 by Algeron, Greg Boggs, heddn: Add option to remove...
greg boggs’s picture

Your 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.

heddn’s picture

In that last commit I don't see an import for Unicode. Are you sure it works?

greg boggs’s picture

I 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.

greg boggs’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

yogeyoge’s picture

Category: Feature request » Task
StatusFileSize
new982 bytes

Language 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.

greg boggs’s picture

Yoge, 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.