Skip to content

[Form] PercentType support for hiding the percent symbol #28796

Closed
@d42ohpaz

Description

@d42ohpaz

Description
Similar to the MoneyType currency option, it would be beneficial to add an option to the PercentType that would allow disabling the percent symbol (%). The default should be true to keep backward compatibility, but accept false to disable it being rendered in Twig.

Example

$this->createFormBuilder($entity)
    ->add('percent', PercentType::class, [
        'symbol' => false,
    ]);

...

{{ form_widget(form.percent) }} 

The above would render:

<input type="text" id="my_form_percent" name="percent" required="required">

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions