thormeier / breadcrumb-bundle Goto Github PK
View Code? Open in Web Editor NEWSymfony bundle for easy breadcrumbs management
License: MIT License
Symfony bundle for easy breadcrumbs management
License: MIT License
Hi,
I'm trying to use your bundle within my symfony 2 project, but I'm getting an error when I use it to pass parameters to dynamic routes.
I get the following error You have requested a non-existent service "thormeier.breadcrumb.breadcrumb_provider"
Your documentation says nothing on anything that has to do with that, besides of customizing it, but I just want to keep it as default. Can you tell me what I'm missing? Do I have to import a Class in order to use it?
Hi,
At the moment I'm adding breadcrumbs for dynamic routes like this:
$this->get('thormeier_breadcrumb.breadcrumb_provider')
->getBreadcrumbByRoute('release_notes_show')
->setRouteParameters(array(
'id' => $entity->getId(),
))
->setLabelParameters(array(
'name' => $entity->getTitle()
));
However, when I use {{ breadcrumbs() }}
in my twig template, that route is not there.
symfony 3.2.2
last thormeier/breadcrumb-bundle
controller :
public function entrepriseViewAction(Entreprise $article, $slug) {
$breadcrumbProvider = $this->get('thormeier.breadcrumb.breadcrumb_provider');
$crumb = $breadcrumbProvider->getBreadcrumbByRoute('site_entreprise_view');
$crumb->setRouteParams([ 'slug' => $article->getSlug(), ]);
$crumb->setLabelParams([ 'name' => $article->getNom(), ]);
return $this->render('SiteBundle:Default:entreprise-view.html.twig', array('article' => $article));
}
route :
site_entreprise_view:
path: /entreprise-a-reprendre/{slug}
defaults: { _controller: SiteBundle:Default:entrepriseView}
options:
breadcrumb:
label: "Entreprise : %name% "
parent_route: site_reprise
when i go on the page :
The parameter "name" must be defined.
i had forgot anything ?
this line triggers loading all routes on each request: https://github.com/thormeier/breadcrumb-bundle/blob/master/Provider/BreadcrumbProvider.php#L74
we should try to see if we can get that information from the route cache instead, to improve performance.
Fix, please:
private function generateBreadcrumbCollectionFromRequest()
{
/*.......*/
$collection->addBreadcrumb(new Breadcrumb(
$rawCrumb['label'], $rawCrumb['route']
));
/*.........*/
}
Hi, is it possible to configure the breadcrum with annotation ?
Hi,
I get an error
[ "exception" => ErrorException { #message: "User Deprecated: The "routing.loader" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead." #code: 0 #file: "./vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php" #line: 275 #severity: E_USER_DEPRECATED trace: { ./vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php:275 { …} ./vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php:56 { …} ./vendor/symfony/symfony/src/Symfony/Component/Routing/Router.php:367 { …} ./vendor/symfony/symfony/src/Symfony/Component/Routing/Router.php:289 { …} Symfony\Component\Routing\Router->Symfony\Component\Routing\{closure}() {} ./vendor/symfony/symfony/src/Symfony/Component/Config/ResourceCheckerConfigCacheFactory.php:43 { …} ./vendor/symfony/symfony/src/Symfony/Component/Routing/Router.php:302 { …} ./vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php:73 { …} ./vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php:55 { …} ./vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php:52 { …} ./vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:207 { …} ./vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:166 { …} ./vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php:121 { …} ./vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:252 { …} ./vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:936 { …} ./vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:83 { …} ./vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:222 { …} ./vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:71 { …} ./vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:129 { …} ./bin/console:28 { › $application = new Application($kernel); › $application->run($input); › } } } ]
because of this "$container->setAlias('routing.loader', 'thormeier_breadcrumb.routing.attach_breadcrumb_loader');"
Hi,
Thank you for your breadcrumb bundle.
Is it possible to add the symfony/framework-bundle": "5.0.*" to your composer.json.
I can't use it in symfony 5.
Best regards
The Twig_Function_Method class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFunction instead.
BreadcrumbExtension file is using twig deprecated method Twig_Function_Method.
Regards
Using this bundle in Symfony 4.2, I now get the deprecation warning:
A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.
The warning is generated by line 20 of this file:
thormeier\breadcrumb-bundle\DependencyInjection\Configuration.php
Do you like to have a PR for support of bootstrap template so that users are able to simple enable it via config?
See e.g. http://getbootstrap.com/components/#breadcrumbs
# app/config/config.yml
thormeier_breadcrumb:
template: 'breadcrumbs_bootstrap.html.twig'
{# vendor/thormeier/breadcrumb-bundle/Resources/views/breadcrumbs_bootstrap.html.twig #}
{%- if breadcrumbs|length -%}
<ol class="breadcrumb">
{%- for crumb in breadcrumbs -%}
{%- set crumbText = crumb.label|replace('%%', '%')|trans(crumb.labelParameters) -%}
{%- if crumb.route == app.request.get('_route') -%}
<li class="active">
{{- crumbText -}}
</li>
{%- else -%}
{%- set crumbPath = path(crumb.route, crumb.routeParameters) -%}
<li>
<a href="{{ crumbPath }}" title="{{ crumbText }}">{{ crumbText }}</a>
</li>
{%- endif -%}
{%- endfor -%}
</ol>
{% endif -%}
Another option would be to provide default implementations for schema markup.
I can open one or more issues for Microdata, RDFa and JSON-LD if you mind.
See http://schema.org/breadcrumb and http://schema.org/breadcrumbList for implementation details.
Hi,
Is the bundle compatible with Symfony 3?
If so do you have any suggestions of how we go about it
Kind Regards,
Andrew
The replace('%%', '%')
is deprecated (since [email protected]) and is removed in [email protected].
Updating it by replace({ '%%': '%' })
fixes this 😄 .
when on a route that has no breadcrumbs configured, i still get an empty <ul>
tag. could we detect this situation in the twig extension and return ''
? i think that would make more sense
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.