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

Possible bug in email Tag helper?

{{ email_field('email', "class": "form-control") }}

For some reason, this bombs Phalcon with a 500 error: "PHP Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW)"

Removing "class": "form-control" stops the error. For whatever reason, it looks like the email tag does not support other attributes? This doesn't occur on any other tag (converting this to a text_field worked fine).



98.9k

Try:

{{ email_field(['email', "class": "form-control"]) }}

That worked. Is there a reason this one works differently than the others? There doesn't seem to be an explanation in the documentation.



98.9k

That helper is missing on this list: https://github.com/phalcon/cphalcon/blob/master/ext/mvc/view/engine/volt/compiler.c#L788, so that is why is not supporting parameters by name. Actually, all the helpers accept an array as parameter

try

{{ email_field('email', ["class": "form-control"]) }}

it works on phalcon 2.0