Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There is any plan to support horizontal forms? http://twitter.github.com/bootstrap/base-css.html#forms
Comments
Comment #1
zmove CreditAttribution: zmove commentedSame here. Its quite complex actualy to theme form horizontaly.
It would be great to have a module, or in the theme option that list all the drupal form and you can check the form you want to see horizontal.
Regards,
Alex
Comment #2
sunshinee CreditAttribution: sunshinee commentedI'm working on this for a project and will submit a patch for review when complete. May be a little while, though. :)
Comment #3
jeff h CreditAttribution: jeff h commented@sunshinee — you've had a little while, I want your work already :D
But seriously — Drupal is a giant pain when it comes to the markup it wants to put around form fields, and what it allows you to put attributes on. For example, in order to put attributes on field labels such as
col-sm-x
, I had to overridetheme_form_element_label()
and make it use a custom attribute (which I called#label-attributes
).I'm wondering if a form-level switch could be made to enable this on any form. Eg something like:
This could then trigger some theme-level magic which rejigs the form field rendering so each field is classed and wrapped appropriately for Bootstrap. I propose we default to col-sm-3 on labels and col-sm-9 on fields. This could optionally be customised on each field, using the #bootstrap idea from above to trigger useful markup on fields e.g.
Initially this would be enabled on a form via a
form_alter()
but conceivably a config UI could be created allowing any form to be made horizontal.@theme_maintainers — would you consider rolling in something like this?
Comment #4
sunshinee CreditAttribution: sunshinee commented@jeff-h I know, right?
In all honesty, I ended up having another project take priority over this one (surprise! ugh!). I think we're looking toward a similar end. My thought was to make a theme setting to enable horizontal forms, with an input field for the form IDs to be rendered horizontally. The same could be done for inline forms.
Admittedly, this could be more complex than I envisioned. I LOVE the idea of a per-form setting, but am hesitant about the many ways this could go wrong in terms of support for modules and custom forms. That isn't to say the approach I came up with is better, but it's what I've been favoring.
Would love your thoughts on this as I should be able to refocus on this in the next couple of weeks.
~Joy
Comment #5
markhalliwellThis is likely going to happen in the next major release, probably via a companion module (themes can only do so much) that can provide an easy to use UI to configure core forms and webforms.
Comment #6
markhalliwellComment #7
markhalliwellChanging to proper branch version for #2554199: Bootstrap 4.
Comment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@marccarver I have started to introduce some very basic Bootstrap fixes/workarounds into Webform 8.x-5.x.
I do not think you need to do anything because I am willing to bet someone is going to have a major D8 project that is using both Bootstrap and Webform and they can start addressing any new issues that come up.
@see #2862483: Down arrow icon won't display on Select2 drop-down element with Bootstrap theme
Comment #9
markhalliwellConsidering that webform 8.x-5.x is doing it's own thing, I don't think this is going anywhere anytime soon.