8000 [Form] Remove default option grouping in TimezoneType by ro0NL · Pull Request #31293 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Remove default option grouping in TimezoneType #31293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2019
Merged

[Form] Remove default option grouping in TimezoneType #31293

merged 1 commit into from
Apr 29, 2019

Conversation

ro0NL
Copy link
Contributor
@ro0NL ro0NL commented Apr 27, 2019
Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #...
License MIT
Doc PR symfony/symfony-docs#...

This removes some complexity from the TimezoneType. The default option grouping is really a simple group_by (+ choice_label) configuration for the end-user, i.e.:

'group_by' => function($choice) {
    if (false !== $i = strpos($choice, '/')) {
        return substr($choice, 0, $i);
    }

    return 'Other';
},

The grouping labels are not really i18n friendly, so i think SF should opt-out by default.

@ro0NL
Copy link
Contributor Author
ro0NL commented Apr 29, 2019

(failures unrelated; deps=high should pass once merged upstream)

@fabpot
Copy link
Member
fabpot commented Apr 29, 2019

Thank you @ro0NL.

@fabpot fabpot merged commit ebe6179 into symfony:master Apr 29, 2019
fabpot added a commit that referenced this pull request Apr 29, 2019
…(ro0NL)

This PR was squashed before being merged into the 4.3-dev branch (closes #31293).

Discussion
----------

[Form] Remove default option grouping in TimezoneType

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

This removes some complexity from the TimezoneType. The default option grouping is really a simple `group_by`  (+ `choice_label`) configuration for the end-user, i.e.:

```php
'group_by' => function($choice) {
    if (false !== $i = strpos($choice, '/')) {
        return substr($choice, 0, $i);
    }

    return 'Other';
},
```

The grouping labels are not really i18n friendly, so i think SF should opt-out by default.

Commits
-------

ebe6179 [Form] Remove default option grouping in TimezoneType
@ro0NL ro0NL deleted the tz-form branch April 29, 2019 08:36
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.3 Apr 30, 2019
@fabpot fabpot mentioned this pull request May 9, 2019
fabpot added a commit that referenced this pull request May 13, 2019
…mezoneType (ro0NL)

This PR was merged into the 4.3 branch.

Discussion
----------

[Form] Add intl/choice_translation_locale option to TimezoneType

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #28836
| License       | MIT
| Doc PR        | symfony/symfony-docs#11503

final step :)

for now i think any form of grouping is a user concern (i.e. by GMT offset or area name); see #31293 + #31295

having a special built in `group_by' => 'gmt_offset'` util would be nice, and can be done in the future.

includes #31434

Commits
-------

001b930 [Form] Add intl/choice_translation_locale option to TimezoneType
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0