Skip to content

Commit

Permalink
feature #3976 Display a gray separator line with menu sections (seb-j…
Browse files Browse the repository at this point in the history
…ean)

This PR was merged into the 3.0.x-dev branch.

Discussion
----------

Display a gray separator line with menu sections

Hi,

I have a gray separator line with menu sections:

![Capture](https://user-images.githubusercontent.com/12116264/99792274-25090880-2b27-11eb-977e-34c36246f7c8.PNG)

```php
public function configureUserMenu(UserInterface $user): UserMenu
{
    return UserMenu::new()
        [...]
        ->addMenuItems([
            MenuItem::linkToRoute('My Profile', 'fa fa-id-card', 'profile_edit'),
            MenuItem::linkToRoute('Settings', 'fa fa-user-cog', 'profile_settings'),
            MenuItem::section(),
            MenuItem::linkToLogout('Logout', 'fa fa-sign-out'),
        ]);
}
```

Related #3276

Commits
-------

d92341e Update layout.html.twig
  • Loading branch information
javiereguiluz committed Jan 23, 2021
2 parents a599155 + d92341e commit 794186d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Resources/views/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,14 @@
{% if ea.userMenu.items|length > 0 %}
<div class="popover-content-section user-menu">
{% for item in ea.userMenu.items %}
<a href="{{ item.linkUrl }}" class="user-action {{ item.cssClass }}" target="{{ item.linkTarget }}" rel="{{ item.linkRel }}" referrerpolicy="origin-when-cross-origin">
{% if item.icon is not empty %}<i class="fa fa-fw {{ item.icon }}"></i>{% endif %}
<span>{{ item.label }}</span>
</a>
{% if item.isMenuSection %}
<hr class="m-0" />
{% else %}
<a href="{{ item.linkUrl }}" class="user-action {{ item.cssClass }}" target="{{ item.linkTarget }}" rel="{{ item.linkRel }}" referrerpolicy="origin-when-cross-origin">
{% if item.icon is not empty %}<i class="fa fa-fw {{ item.icon }}"></i>{% endif %}
<span>{{ item.label }}</span>
</a>
{% endif %}
{% endfor %}
</div>
{% endif %}
Expand Down

0 comments on commit 794186d

Please sign in to comment.