Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
system.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Feb 2023 at 08:49 UTC
Updated:
11 Sep 2025 at 09:54 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #2
alexpottWell this fallback is suppose to prevent empty titles but it's not.
Comment #3
alexpottSomething like this would make the fallback work as expected.
Comment #4
smustgrave commentedLocally ran testEmptyStringStaticTitle without the fix and it passes. Shouldn't this fail? If not would this be out of scope as it's not testing the bug?
Comment #5
alexpott@smustgrave yeah that's because of how the code currently works. The test that fails is \Drupal\Tests\Core\Controller\TitleResolverTest::testDynamicTitle(). I added \Drupal\Tests\Core\Controller\TitleResolverTest::testEmptyStringStaticTitle() to show that currently the way dynamic and static title behave is inconsistent.
I've added yet another test to prove consistent behaviour - testing a route with absolutely no title - ie. no callback or _title.
Comment #6
alexpottSo if we do steps to reproduce on #3220437: [PP-1] Empty breadcrumb at node/add and node/add/{content_type} when frontpage view is enabled you get a breadcrumb of Home >> Node - it creates a title of Node based on the path. So this code...
Is working as expected. BUT for me this code is pretty interesting if you consider multilingual sites. Paths in Drupal especially the admin interface will be English so I'm not convinced that this behaviour is correct. Another option would be to omit pages without titles from breadcrumbs.
Comment #8
andypostMaybe better to check for instance of before converting value to string value object?
Comment #9
alexpott@andypost === does not convert anything - see https://3v4l.org/cWOn9
Comment #10
andypostThanks 👍 then only #6 a question, maybe follow-up to discuss what to do with empty title for breadcrumbs, for example instead of omitting we can display elepsis character to make it navigable
Comment #11
aaronmchaleYeah I also find it interesting that "Batch" and "Node" start appearing with the relevant patch(s) applied. Agree with comment #6, and I guess we're only now seeing the true result of what that part of the Breadcrumb Builder ends up outputting, which is technically better than a weird looking empty breadcrumb part.
Technically the patch works as expected, so happy to RTBC this.
But as noted we should revisit that part of the Breadcrumb Builder to determine if that is actually the behaviour we want.
Comment #12
alexpottDiscussed with @catch and @larowlan - there is consensus that rather than using the path we should skip the link - like we do for items that a user does not have access too.
Comment #13
alexpottFor #11
Comment #14
alexpottHere's an implementation that skips paths with no titles. We'll need a change to update this.
Comment #15
smustgrave commentedHere's a screenshot of visiting /batch/11
Breadcrumb is not rendering empty crumb, example Home > [blank]
Moving to NW for the change record.
Comment #17
vipul tulse commentedRerolled patch for Drupal 10.3.0
Comment #20
acbramley commentedComment #21
acbramley commentedComment #22
smustgrave commentedLast step for a CR appears complete. Believe this one is good to go
Comment #23
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #24
acbramley commentedComment #26
catchCommitted/pushed to 11.x, thanks!
I think this is more of a straight bugfix than a behaviour change, but given the CR etc. playing it safe and not backporting it.