Git Product home page Git Product logo

Comments (5)

stof avatar stof commented on July 27, 2024

But people who want to use routes (and many Sf2 users will) would have to use $menu->addChild('Fooooo', null, array('route' => 'homepage')) which is also ugly. Using a separate parameter for the uri makes it really ugly when it is omitted.

from knpmenu.

weaverryan avatar weaverryan commented on July 27, 2024

I really don't like the route, routeParameters and routeAbsolute options - and yes, I realize that they were in my original version :), but we've come a long way since then. I think that regardless of the framework, people are used to generating a URL in a certain way. We should have them use that same method when creating a menu and not cloud things:

// symfony
$menu->addChild('Fooooo', $router->generateUrl('homepage'));

// Silex
$menu->addChild('Fooooo', $app['url_generator']->generateUrl('homepage'));

What do you think?

from knpmenu.

stof avatar stof commented on July 27, 2024

this was the way it was done in the previous version (as the MenuItem was not router-aware) but this was an issue for the createFromNode feature as an entity cannot have access to the router, thus having to have a router-aware factory in this place. Once we have it, why supporting the route for one method and not the other ?

from knpmenu.

weaverryan avatar weaverryan commented on July 27, 2024

ah damn, you're right - and the createFromNode is really cool. Ok, let's leave it, though I'm still torn on how we should document it. If you have a basic route, route => 'homepage' is cool. But as soon as you have route parameters, I think it starts to get cloudy, but maybe not.

Thoughts on that?

from knpmenu.

stof avatar stof commented on July 27, 2024

I don't see another way than asking to give the route parameters. The user would have to do the same when using the generator directly.

from knpmenu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.