Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
menu system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
27 Sep 2014 at 04:14 UTC
Updated:
11 Oct 2015 at 14:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tim.plunkettComment #2
tim.plunkettComment #3
tim.plunkettThis still doesn't address the fact that breadcrumb.html.twig bypasses the LinkGenerator... Separate issue?
Comment #4
geerlingguy commented+1, this should at least fix the problem and allow the API to work as it says it should.
Comment #5
tim.plunkettThis would fix that part too. Needs tests for both.
Comment #6
Crell commentedThis seems like it's papering over the inconsistency rather than fixing it. Why not amend the preprocessor to take an array of link objects only instead of the mixed approach, which creates inconsistency and complexity?
Comment #7
star-szrAlso, now that we have a link generator available from Twig, this seems pretty related:
#2342745: Allow Twig link function to pass in HTML attributes
Comment #8
jhedstromStill needs tests, and I don't think #6 has been addressed.
Comment #9
kgoel commentedReroll, working on #6 and tests
Comment #10
Crell commentedI'd rather we fix the inconsistency rather than working around it.
Comment #11
dawehnerWell, I think the alter documentation should be adapted, value objects are a good thing to use here.
Comment #12
dawehnerThey are especially helpful as we potentially could cary along the cacheability metadata.
Comment #13
dawehnerTo be clear, there are usecases to add for example the title of the current page onto the breadcrumb. This is something just done on the theme level, its no logic involved in that,
so a preprocess function should be able to add a string there. This means the template doesn't change.
Comment #14
fgmSo in short, this means the template_preprocess_breadcrumb() should look like this .
Comment #15
kgoel commentedComment #17
fgmIt could be like this, maybe : the menu_test code generates a breadcrumb with both link and plain strings, which are preprocessed normally.
Comment #19
kgoel commentedComment #21
Crell commentedMinor nit:
An extra space crept in here.
Comment #22
dawehnerhook_system_breadcrumb_alter() now also deals with link objects only.
Let's just fix the docs here.
Comment #23
berdirFine, but then we should fix them properly, that makes no sense, now you're doing createFromRoute() with the return value from Drupal::l() :)
Comment #24
berdirFor the record, having a breadcrumb that is *not* a link is a perfectly valid use case, e.g. if you want to current page also be shown in the breadcrumb. I did that now with the route:
Link::createFromRoute($title, '<none>');Comment #25
joelpittetI agree and have a use case in d7 where my client had a mega menu and the headings need to be in the menu aka
<nolink>from the special menu items project.Home link > section title > sub section link > current page titleComment #26
dawehnerWhen we talked about that on some other issue we came to the conclusion that no link is part of the template level, not part of the breadcrumb level for itself.
So its a different domain where you need just the current page title, which can be implemented purely on the theme level.
Comment #27
mr.baileysAddresses #23
Comment #28
dawehnerHa, good point!
Comment #29
wim leersComment #30
alexpottCommitted 0b5b1f1 and pushed to 8.0.x. Thanks!