-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
[TwigBridge] Added form_twitter_bootstrap_x.y.z_layout.html.twig #10272
Conversation
I don't think it be a good idea, |
@aitboudad I'm working on a simple integration of TB3. Therefore, as TW is almost a standard, IMHO we can add some optional layout into the twig bridge. |
@lyrixx well if we will add TB3, I propose also to add: But the problem is that there are many versions, for example TB2. |
@aitboudad Feel free to open a PR ;) |
-1 |
+1 |
1 similar comment
👍 |
@aitboudad BTW, this code should not belong to a bundle, because it is not re-usable (in a silex application for instance). |
+1 |
1 similar comment
👍 |
-1, this is something the community should be doing in contributed bundles, it does not belong into core imo |
Like @wouterj said, I think this such implementation should be done by community in separated bundle (or something like that). It's not a twig bridge task to integrate Twitter Bootstrap with symfony form. |
I dont get the negativity for adding this, how many are going to install a Bundle to get a template for the form component? Currently there is two layouts, table and div adding theese are good usecases on how to customize the form layouts. Which IMO is a part of forms that are not documented that good. |
Adding an opinionated thing to the core just because the docs are not good is a no-go imo. Then the docs should be improved instead. And indeed, a package would be a better fit instead of a bundle. The core just needs to be as less opinionated as possible, which did go pretty well until this PR :) |
Well i would not see a Bridge as a core thing. It is an extension for other libraries, none said it had to be php libraries, that is the same as saying we cant have a Doctrine bridge because we are opiniated about using Doctrine over Propel. |
@henrikbjorn if we created a BootstrapBridge, you would not see me commenting with -1. This bridge is about implementing twig into Symfony, not twitter bootstrap. |
+1 |
👍 Deciding if something like this belongs to the core is always tricky. But please, consider the following two pro-core arguments:
|
👍 Can't agree more with Javier! |
@lyrixx you should add "twbs/bootstrap" in composer suggested packages. |
@aitboudad ohh please no. There are already waaayyy too many suggested packages and it have no value (only the very first time a package is installed). |
👍 |
-1 |
@javiereguiluz as a matter of facts, there are 33 bundles related to jQuery, 32 about payment, 67 about admin generators/interfaces, 38 about caching, 39 are shop/cart related, etc. Symfony core will get pretty big this way 😉 |
-1 For the same reasons @wouterj mentioned (and more useful/general things have been rejected to keep the core clean). |
@lyrixx well, bundle templates/resources/code are reusable into silex. They just aren't auto discovered and you can't register its bundle. @henrikbjorn there is aslo a propel1 bridge because it has been decided to officially support it. So the question is to know if symfony officially supports bootstrap, in which case having a form theme as a bridge makes sense. |
@wouterj yes, there are a lot of bundles for a lot of things: if jQuery bundles are just for including it, they are unnecessary (thanks to grunt, bower, requireJS); payments/cart/shop bundles are too specific (useful only for e-ecommerce sites); caching bundles are non-essential because Symfony resolves this problem well; 67 admin generator bundles is a clear proof that Symfony lacks a real generator, which is needed by everyone. @hacfi the core isn't clean and it provides a lot of things that nobody needs, such as the percent and birthday fields and the IP and ISSN validators. This discussion about Bootstrap reminds me the Apache discussion. A few years ago, Symfony decided to include a It would be nice to support Bootstrap-theme forms out-of-the-box without the need to install or configure anything. |
-1 |
@MaksBaum Bootstrap is not "one CSS framework" but the most popular framework by a huge distance, the most popular project in GitHub history, and one of the projects that have revolutionized the frontend. And don't forget that Symfony already has a lot of features aimed for only one product, service, or vendor:
|
I'm slightly in favor of adding this, for the reasons outlined by @javiereguiluz. However, why are you building a completely new Bootstrap theme here instead of building upon a tried and proven one from one of the various Bootstrap bundles out there? |
I think there is a big misunderstanding here. We will not package bootstrap into Symfony. We will only include a form theme optimized for bootstrap. |
-1 |
@fabpot @javiereguiluz @webmozart @henrikbjorn Create a Symfony Bridge for Bootstrap (not inside Twig) and I'm sure half of the complains are gonna disappear. |
1 similar comment
@lyrixx Any feedback to that? |
👍 |
1 similar comment
👍 |
@webmozart by inline, you mean horizontal ? Anyway, indeed I forgot the collection type, But I added a sub-form. This is quit similar ;) I will add more sample. |
@lyrixx Cool, thanks! :) |
{{- parent() -}} | ||
{%- endblock textarea_widget %} | ||
|
||
{% block submit_widget -%} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a block for the button_widget.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it needed ? You can still override it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To maintain a uniform design to use as both submit and button
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using this theme, and i created a form with one submit and one button types, in the view the submit is pretty printed, but the button does not.
Should not paint boths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure to understand what you want. Can you paste here the wanted block? Thanks ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for my bad English :/
{% block button_widget -%}
{% set attr = attr|merge({class: (attr.class|default('') ~ ' btn')|trim}) %}
{{- parent() -}}
{%- endblock %}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, Got it. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! :)
Thank you @lyrixx. |
….html.twig (lyrixx) This PR was merged into the 2.6-dev branch. Discussion ---------- [TwigBridge] Added form_twitter_bootstrap_x.y.z_layout.html.twig | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | not yet Doc: ``` yaml # config.yml twig: form: resources: - form_twitter_bootstrap_2.3.x_layout.html.twig ``` or ```jinja {% form_theme form 'form_twitter_bootstrap_2.3.x_layout.html.twig' %} {{ form(form) }} ``` Commits ------- cfc04a6 [TwigBridge] Added form_twitter_bootstrap_layout.html.twig
Awesome. If somebody uses Glyphicons or FontAwesome below example which replaces default list style to icon. Replace:
With:
|
@Macsch15 you should create a PR for this. |
PR: #12164 |
I'm wondering if there's any tutorial on how can i add this using Silex? Or any tutorials that implement something similar to this project into Silex? |
@simplynice25 The documentation is coming ;) |
@lyrixx thanks! Will wait! :D |
Thanks for this PR ! yeah for pragmatic. |
-1, We had a very similar and long discussion in Drupal 8 core issue queue: |
@joelpittet it does not make sense to start the discussion again. The code is merged and the decision is made. Maintainers, this may be a good issue to lock? |
Doc:
or