diff --git a/includes/form.inc b/includes/form.inc index fa52b74..d97b6c7 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -260,6 +260,22 @@ function bootstrap_button($variables) { $label = $element['#value']; element_set_attributes($element, array('id', 'name', 'value', 'type')); + // If a button type class isn't present then add in default. + $button_classes = array( + 'btn-default', + 'btn-primary', + 'btn-success', + 'btn-info', + 'btn-warning', + 'btn-danger', + 'btn-link', + ); + $class_intersection = array_intersect($button_classes, $element['#attributes']['class']); + if (empty($class_intersection)) { + $element['#attributes']['class'][] = 'btn-default'; + } + + // Add in the button type class. $element['#attributes']['class'][] = 'form-' . $element['#button_type']; if (!empty($element['#attributes']['disabled'])) { $element['#attributes']['class'][] = 'form-button-disabled'; diff --git a/includes/theme.inc b/includes/theme.inc index 9a9e45a..bc8dc7c 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -134,6 +134,9 @@ function theme_bootstrap_btn_dropdown($variables) { if (isset($variables['type'])) { $type_class = ' btn-'. $variables['type']; } + else { + $type_class = ' btn-default'; + } // Start markup $output = '';