If I'm adding a plain text alternative title field on any content type, for example field_breadcrumb_title and using this field machine name in the easy_breadcrumb settings, the module doesn't use the value of this field in the breadcrumb.

When I'm looking in the file EasyBreadcrumbBuilder.php in the function getTitleString, the titleResolver->getTitle doesn't use the TitleResolver.php from the easy_breadcrumb module but uses the core TitleResolverInterface instead. So it never passes the part in the easy_breadcrumb TitleResolver.php file were the alternative field is being picked up.

Am I right or am I missing something here?

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Seppe Beelprez created an issue. See original summary.

seppe beelprez’s picture

Title: Alternative not working » Alternative title not working
seppe beelprez’s picture

Issue summary: View changes
greg boggs’s picture

Can you try the dev branch and see if that's better?

seppe beelprez’s picture

I installed the dev branch together with the latest patch from https://www.drupal.org/project/easy_breadcrumb/issues/3253835 but I can't get the alternative field to work.

Maybe it's a combination of settings, I will try and test various combinations now.

seppe beelprez’s picture

This is what I tried to get it working: dev branch + latest patch from here https://www.drupal.org/project/easy_breadcrumb/issues/3253835

Easy Breadcrumb settings:
- Include the current page as a segment in the breadcrumb: enabled
- Include the front page as a segment in the breadcrumb: enabled
- Alternative title field name for breadcrumb: value for this field: field_breadcrumb_title
- Title for the front page segment in the breadcrumb: value for this field: Home
- Follow redirects.: enabled

Then I found out that, even with only the "Alternative title field for breadcrumb", it never executed the part of the code that uses the: getTitleString($route_request, $route_match, $replacedTitles);

What I did instead is add the following on line 554 in EasyBreadcrumbBuilder.php as I assume when you want to use the alternative title field, this should be the most important setting if the node has a value for this field offcourse.

if ($this->config->get(EasyBreadcrumbConstants::ALTERNATIVE_TITLE_FIELD)) {
    $title = $this->getTitleString($route_request, $route_match, $replacedTitles);
}

Is it possible for you to check this and try it with the same settings as I have?

tavib47 made their first commit to this issue’s fork.

tavib47’s picture

Patch for 2.0.2 version

marcoscano’s picture

Status: Active » Needs review
StatusFileSize
new995 bytes

Patch in #9 works for me, but it gets stale if the alternative title is changed.
Updated patch adds the entity as a cache dependency to the breadcrumb object (which surprises me wasn't being included yet, but 🤷‍♂️ )

szloredan’s picture

StatusFileSize
new1.03 KB

Reroll for 2.0.3

joakland’s picture

Patch in #11 works for me.

greg boggs’s picture

Status: Needs review » Reviewed & tested by the community
greg boggs’s picture

It looks like the merge request is still at the patch in #9. If someone updates the merge request with the patch from #11, I'll go ahead and merge this.

omkar-pd made their first commit to this issue’s fork.

omkar-pd’s picture

Status: Reviewed & tested by the community » Needs review

Updated the MR for patch #11 and 2.0.3 as per #14. Moving this to Needs review again.

greg boggs’s picture

Status: Needs review » Fixed

Thanks Omkar!

  • Greg Boggs committed af6987f on 2.x authored by tavib47
    Issue #3254436 by tavib47, omkar-pd, marcoscano, szloredan, Seppe...

Status: Fixed » Closed (fixed)

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

user0249’s picture

Version: 2.0.1 » 2.x-dev