KnpLabs / KnpLabs/KnpMenu

Better class attribute rendering

Open
#181 3 comments 0 reactions 0 assignees View on GitHub
Waiting for user's input
Dominant language
PHP
Stars
1.4k
Forks
189
PR merge metrics
No merged PRs in 30d

Description

When setting the `firstClass` and/or `lastClass` options to `null` or an empty string, like this:

```
{{ knp_menu_render('AcmeDemoBundle:Builder:mainMenu', { 'firstClass': null, 'lastClass': null }) }}
```

A menu with the following `class` attributes is rendered:

```


  • ...

  • ...


```

Even though this is completely valid markup, it would be nice if the trailing space after the class `current` would be gone, as well as the empty `class` attributes:

```


  • ...

  • ...


```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the renderer behind the knp_menu_render call and trace handling of the firstClass and lastClass options. Done means null or empty options produce no trailing class-space and omit empty class attributes, matching the rendered examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.