Git Product home page Git Product logo

Comments (6)

benjamindulau avatar benjamindulau commented on May 20, 2024 1

I agree with @mbontemps, it's not intuitive.

I'm not sure about the semantic thing. A filter transforms or adapts a value that already has a "meaning" (a date for instance).
Here, 'main' is used just to find something, it's not a value intended for display.

It has its place as a function argument => "Go find my menu named 'main' and render it".

from knpmenu.

stof avatar stof commented on May 20, 2024

It has never been a tag. It was a function: {{ knp_menu(menu) }} in the previous version.
And a filter is more semantic than a function for this as it transform the input into another value (this is also the reason why the date filter is a filter in Twig, not a function)

from knpmenu.

stof avatar stof commented on May 20, 2024

the filter accept 2 things: the menu object, or the name for the menu in the provider.

from knpmenu.

benjamindulau avatar benjamindulau commented on May 20, 2024

Still, IMO perhaps both filter and method should be proposed. The filter transforms a menu object, and the method takes a menu name.

from knpmenu.

weaverryan avatar weaverryan commented on May 20, 2024

I don't think I like having both a filter and a function (which behave differently), but I think that @benjamindulau is perfectly logical: filtering the menu object makes sense, but filter a string into a full menu just doesn't feel right.

Also, I think a function is more consistent with how the Symfony form framework works, and it's also consistent with how you render a menu in PHP (e.g. you pass the menu into a renderer).

So, +1 for making it a function again - I just think it's a little more understandable.

from knpmenu.

weaverryan avatar weaverryan commented on May 20, 2024

Thanks @stof!

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.