Skip to content

Templating helper now does something with the depth option ;-) #53

Merged
merged 2 commits into from Jul 30, 2011

5 participants

@benjamindulau

Also, the depth default value is now 1 instead of null, which is IMO the most common use case.

@benjamindulau benjamindulau When rendering the menu through a twig template, the depth option.
Also, the depth default value is now 1 instead of null, which is IMO the most common use case.
fc15b09
@stof stof commented on an outdated diff Jul 27, 2011
Templating/Helper/MenuHelper.php
@@ -89,7 +89,7 @@ class MenuHelper extends Helper implements \ArrayAccess
* @param string $template (optional)
* @return string
*/
- public function render($name, $path = null, $depth = null, $template = null)
+ public function render($name, $path = null, $depth = 1, $template = null)
@stof
KNP Labs member
stof added a note Jul 27, 2011

it should not set a default depth but render the whole tree when set to null, to match the behavior of the RendererInterface

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@stof
KNP Labs member
stof commented Jul 27, 2011

btw, the $path variable should be removed from the helpers as the initialize method does not exist (and does not seem to have existed anywhere in the history IIRC)

@rubensayshi

Indeed $path does nothing and the comments on the methods even skip it when defining the @ param's

@benjamindulau

I have updated the PR.
Default value for the "depth" option is back to "null" and i've removed the unused "path" option

@uwej711
uwej711 commented Jul 30, 2011

Hi,

i build PR #55 based on this to automatically set the current uri in the MenuHelper class. Without this PR here the MenuFactory will not work since MenuHelper calls initialize which is not implemented in the MenuItem class that is used by the MenuFactory

@mbontemps mbontemps merged commit 499b7a3 into KnpLabs:master Jul 30, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.