-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breadcrumbs #75
Comments
There is a method to get a "breadcrumb-ready" array : https://github.com/knplabs/KnpMenu/blob/master/src/Knp/Menu/MenuItem.php#L744, but it's true there is no renderer for that. Please open a PR to let us see what it looks like, thanks! |
@tiagojsag: will you open a PR for your renderer? we need this too and we'd otherwise create one for breadcrumbs. |
Hi, Right now I have no availability to handle a PR on this subject, because my code doesn't take into account the existing functionality described above, which means I'd have to spend time I unfortunatly don't have on modifications. I'd suggest you open your own PR. I'll try to stop by and contribute if I can, but no promises on that :( Good luck! |
okay, thanks for the info. |
Did you achieved something interesting ? Here is what I've done : {{ knp_menu_render('main', {'template': '::breadcrumb.html.twig'}) }} The breadcrumb.html.twig template : {% block root %} {%- for label,url in item.currentItem.breadcrumbsArray %} {%- if loop.index > 1 %} > {% endif %} {%- if not loop.last %}<a href="{{ url }}">{{ label | trans }}</a> {%- else %}<span>{{ label | trans }}</span> {%- endif %} {%- endfor %} {% endblock %} |
@sterrien I tried your code but it turn out there's no currentItem method in the class Knp\Menu\MenuItem Still trying to render the breadcrumb. |
This method has been removed (see commit KnpLabs/KnpMenu@34ab1df). I'm not up to date on my project. So it still works ;-) |
See this PR KnpLabs/KnpMenu#45 |
Standardized testing in accordance with component documentation (in PR)
Hi,
I've looked around but couldn't find any way to easily render a breadcrumb, so I developed my own BreadcrumbRenderer. Should you think it's useful to others and within the wanted scope of this project, let me know and I'll push it.
The text was updated successfully, but these errors were encountered: