Skip to content
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

Rendering a breadcrumb with menu in Twig #253

Open
sschueller opened this issue Jan 19, 2017 · 0 comments
Open

Rendering a breadcrumb with menu in Twig #253

sschueller opened this issue Jan 19, 2017 · 0 comments

Comments

@sschueller
Copy link

sschueller commented Jan 19, 2017

Hi,

I am trying the render the following in twig and I wanted to get some feedback on what would make most sense.

A breadcrumb needs to be rendered and the last item (current) is a dropdown toggle which opens a list of the parents children.

What I do right now is render a custom breadcrumb and call a knp menu at the end item but it maybe the cleaner to do this all in one template? Does anyone have any recommendations of how I could do this in one template?

The menu tree:

Root
  |- Item 1
     |- SubItem 1
     |- SubItem 2
        |- 2ndSubItem 1
        |- 2ndSubItem 2
     |- SubItem 3   
  |- Item 2
  |- Item 3
  |- Item 4

Output (when at SubItem 1):

<ol class="breadcrumb">
    <li><a href="#">Item 1</a></li>
    <li>
        <a href="#" class="dropdownopenclose">SubItem 1</a>
        <ul class="dropdownmenu">
            <li><a href="#" class="active">Item 1</a></li>
            <li><a href="#">Item 2</a></li>
            <li><a href="#">Item 3</a></li>
            <li><a href="#">Item 4</a></li>
        </ul>
    </li>
</ol>

Output (when at 2ndSubItem 1):

<ol class="breadcrumb">
    <li><a href="#">Item 1</a></li>
    <li><a href="#">SubItem 2</a></li>
    <li>
        <a href="#" class="dropdownopenclose">2ndSubItem 1</a>
        <ul class="dropdownmenu">
            <li><a href="#">SubItem 1</a></li>
            <li><a href="#" class="active">SubItem 2</a></li>
            <li><a href="#">SubItem 3</a></li>
        </ul>
    </li>
</ol>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant