Symfony 4 was released on November 30th.
Update now to the best Symfony ever!

New in Symfony 3.4: Form improvements

New HTML5 types

Contributed by
Arnaud Petitpas
in #22679.

The HTML5 specification defines several form fields that are still not supported by Symfony Forms. In Symfony 3.4 we implemented two of these new HTML5 form fields which have a good support in modern browsers: TelType (for telephone numbers) and ColorType (for color pickers).

New options for TimezoneType

Contributed by
Roland Franssen
in #23648.

The TimezoneType defines two new options: input and regions. The input option defines the format that the timezone is stored in your underlying object. The value can be string (e.g. America/New_York) and datetimezone (which returns a DateTimeZone object).

The regions option filters the timezones to only display the ones that belong to the given region or regions. For example, to display just the timezones of Europe and America: DateTimeZone::AMERICA | DateTimeZone::EUROPE .

Callbacks in the delete_empty option

Contributed by
Konstantin Myakshin
in #20496.

In addition to boolean values, the delete_empty now accepts PHP callbacks to decide if items should be deleted. In case of compound entries, you can now do this:

1
2
3
'delete_empty' => function (Author $author = null) {
    return null === $author || empty($author->firstName);
},

In case of compound entries without data_class:

1
2
3
'delete_empty' => function ($author) {
    return empty($author['firstName']);
},

Comments

Great Work ,
Thanks
+1 for the ColorType one.

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.