-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Form] Documented "Supporting Bootstrap 4 custom switches" #12464
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c6729ac
to
aaea7a7
Compare
aaea7a7
to
fbfeec1
Compare
Note for the mergers: this must go into @romaricdrigon I updated the base branch |
Thank you! |
fabpot
added a commit
to symfony/symfony
that referenced
this pull request
Nov 3, 2019
…icdrigon) This PR was merged into the 4.4 branch. Discussion ---------- Form theme: support Bootstrap 4 custom switches | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | / | License | MIT | Doc PR | symfony/symfony-docs#12464 Hello, At the moment, Symfony form theme supports [custom checkboxes](https://getbootstrap.com/docs/4.3/components/forms/#checkboxes) through an extra class in `label_attr`. Bootstrap4 introduced also [custom switches](https://getbootstrap.com/docs/4.3/components/forms/#switches), which has exactly the same HTML markup, but use a different class. This PR slightly modify `bootstrap_4_layout` to handle it.  Some reasons why I think supporting those have its place in Symfony: - those are getting common in UI right now, it is a common use case - it is complementary to normal checkboxes, and works the same way: required attribute, validation error, and so on are supported immediately - implementing it yourself in your form theme is actually tricky, because of the way checkbox are handled (ie., `form_label` called inside `form_widget` with a `{ widget: parent() }`). You have to overwrite the whole fragment, otherwise you get an infinite recursion. Finally, some screenshots and code examples. Custom checkbox (as at the moment):  ```php ->add('test', CheckboxType::class, [ 'label_attr' => [ 'class' => 'checkbox-custom', ], ]) ``` Custom switch (proposed):  ```php ->add('test', CheckboxType::class, [ 'label_attr' => [ 'class' => 'switch-custom', ], ]) ``` Commits ------- 99f59e2 Supporting Bootstrap 4 custom switches
symfony-splitter
pushed a commit
to symfony/twig-bridge
that referenced
this pull request
Nov 3, 2019
…icdrigon) This PR was merged into the 4.4 branch. Discussion ---------- Form theme: support Bootstrap 4 custom switches | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | / | License | MIT | Doc PR | symfony/symfony-docs#12464 Hello, At the moment, Symfony form theme supports [custom checkboxes](https://getbootstrap.com/docs/4.3/components/forms/#checkboxes) through an extra class in `label_attr`. Bootstrap4 introduced also [custom switches](https://getbootstrap.com/docs/4.3/components/forms/#switches), which has exactly the same HTML markup, but use a different class. This PR slightly modify `bootstrap_4_layout` to handle it.  Some reasons why I think supporting those have its place in Symfony: - those are getting common in UI right now, it is a common use case - it is complementary to normal checkboxes, and works the same way: required attribute, validation error, and so on are supported immediately - implementing it yourself in your form theme is actually tricky, because of the way checkbox are handled (ie., `form_label` called inside `form_widget` with a `{ widget: parent() }`). You have to overwrite the whole fragment, otherwise you get an infinite recursion. Finally, some screenshots and code examples. Custom checkbox (as at the moment):  ```php ->add('test', CheckboxType::class, [ 'label_attr' => [ 'class' => 'checkbox-custom', ], ]) ``` Custom switch (proposed):  ```php ->add('test', CheckboxType::class, [ 'label_attr' => [ 'class' => 'switch-custom', ], ]) ``` Commits ------- 99f59e262f Supporting Bootstrap 4 custom switches
OskarStark
approved these changes
Nov 6, 2019
wouterj
added a commit
that referenced
this pull request
Nov 9, 2019
…hes" (romaricdrigon) This PR was merged into the 4.4 branch. Discussion ---------- [Form] Documented "Supporting Bootstrap 4 custom switches" Hello, This PR add the doc for the corresponding proposed feature, custom switch support in default form theme:  See the Symfony PR for implementation details. Commits ------- fbfeec1 Documentation for Bootstrap 4 custom switches
Thanks @romaricdrigon! I love this feature :) Fyi, I've made a few (mostly reSt syntax) minor changes in 539ec5e. |
wouterj
added a commit
that referenced
this pull request
Nov 9, 2019
* 4.4: [#12231] Explicitly name the options that can be configured through tags Explain how to add `from_transport` on `messenger.message_handler` tag Documented the new REMOTE_ADDR option [#12464] Minor changes Add Composer installation before step 1 for Symfony Flex Documentation for Bootstrap 4 custom switches
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
This PR add the doc for the corresponding proposed feature, custom switch support in default form theme:
See the Symfony PR for implementation details.