We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Route name for form() function in templates

By default we need to set a full uri in form() function to build a <form> in template, for example:

{{ form('some/great/action/', 'id': 'great_form') }}
    {{ form.render('some_input') }}
    {{ submit_button('Submit') }}
</form>

I can set a name (for example 'great') for route via RouteInterface->setName() function, but can I use this name in templates?



98.9k

You can pass an array as first parameter indicating the name of the route:

{{ form(['for': 'great_form']) }}

It's cool, thanks!