Skip to content

email_field() Volt function doesn't work properly in case of a placeholder parameter #1723

Closed
@dedalozzo

Description

Since there is a problem with the Tag::emailField. I'm a Volt template there is a simple login form using the helpers email_field and password_field.

<form action="{{ baseUri }}/accedi/" id="signinform" name="signinform" method="post" role="form">
  {{ email_field("email", "placeholder": "E-mail") }}
  {{ password_field("password", "placeholder": "Password") }}
  <button type="submit" name="signin" class="btn blue">Accedi</button>
</form>

In the compiled template version you can see clearly that the password_field tag is properly converted, instead the email_field is not. I'm using the 1.2.4 version, I have checked the C code of tag.c and I can't see any difference between the email and the password tags, but the generated PHP is different. I think the problem is located in the Volt engine code. The email_field produces an invalid syntax and the template doesn't work. See below:

<form action="<?php echo $baseUri; ?>/accedi/" id="signinform" name="signinform" method="post" role="form">
  <?php echo $this->tag->emailField('email', 'placeholder' => 'E-mail'); ?>
  <?php echo $this->tag->passwordField(array('password', 'placeholder' => 'Password')); ?>
  <button type="submit" name="signin" class="btn blue">Accedi</button>
</form>

The only way it works is using a different syntax for email_field, putting the parameters between brackets, like follows:


{{ email_field(["email", "placeholder": "E-mail"]) }}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions