sampart / BreadcrumbsBundle

A small breadcrumbs bundle for Symfony
Other
188 stars 68 forks source link

Error when you can render namespaces breadcrums #114

Closed nkl90 closed 4 years ago

nkl90 commented 4 years ago

In microdata.html.twig there is a check:

if wo_breadcrumbs()|length ...

and in getBreadcrumbs() method of twig extension isset default value $namespace = Breadcrumbs::DEFAULT_NAMESPACE and this value is not transmitted in any way from wo_render_breadcrumbs({namespace: "my-namespace"}) function. Because of this, you will never get breadcrumbs from the custom namespace in default template.

I solved it this way:

  1. Override default template
  2. Remove this check (if wo_breadcrumbs()|length)
  3. do this check in my main template:
    {% for c in item.categories %}
    {% if wo_breadcrumbs("namespace-" ~ c.id)|length  %}
        {{ wo_render_breadcrumbs({namespace: "namespace-" ~ c.id}) }}
    {% endif %}
    {% endfor %}

    You still accept pull requests in this repos?

nkl90 commented 4 years ago

But default template do not support render of custom breadcrumbs namespaces.

sampart commented 4 years ago

Thanks for getting in touch, @nkl90. As this codebase is no longer maintained, I'd recommend opening your PR against this maintained fork: https://github.com/mhujer/BreadcrumbsBundle. Thanks again

nkl90 commented 4 years ago

Thanks for your reply!