For proper Bootstrap styling select inputs must have .form-control class. This can be done in absent theme function for selects.

Comments

stan.ag’s picture

Issue summary: View changes

The "problem" is in adding .form-control class in process function _bootstrap_process_input(), which is not launched if you are not using drupal_get_form() for rendering form. So, you can't depend on process functions when writing something like this (my case):

print drupal_render(array('select' => array(
  '#type' => 'select',
  '#title' => t('Select'),
  '#options' => array(
    0 => t('One'),
    ...
    )),
  '#description' => '',
));

In such a case .form-control class will not be added.

I don't know, if this requires change.

justinlevi’s picture

This was driving me nuts and I ended up just solving with some JQuery.

$(".your-form-class-here select, .your-form-class-here input").addClass("form-control");

markhalliwell’s picture

Title: Add .form-control class for select input » Input elements do not add .form-control class using drupal_render
Version: 7.x-3.1-beta1 » 7.x-3.x-dev
Component: Templates » Code
Category: Feature request » Bug report
Status: Needs review » Fixed

  • Mark Carver committed a6c4477 on 7.x-3.x
    Issue #2292901 by stan.ag: Added Input elements do not add .form-control...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.