Skip to content

Instantly share code, notes, and snippets.

@valkum
Created September 11, 2013 13:27
Show Gist options
  • Save valkum/6523583 to your computer and use it in GitHub Desktop.
Save valkum/6523583 to your computer and use it in GitHub Desktop.
diff --git a/includes/form.inc b/includes/form.inc
index fa52b74..4e00680 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -216,8 +216,11 @@ function bootstrap_form_element_label(&$variables) {
*/
function bootstrap_preprocess_button(&$vars) {
$vars['element']['#attributes']['class'][] = 'btn';
-
- if (isset($vars['element']['#value'])) {
+ $core_btn_found = FALSE;
+
+ if (isset($vars['type'])) {
+ $vars['element']['#attributes']['class'][] = 'btn-' . $vars['type'];
+ } else if (isset($vars['element']['#value'])) {
$classes = array(
//specifics
t('Save and add') => 'btn-info',
@@ -246,9 +249,12 @@ function bootstrap_preprocess_button(&$vars) {
foreach ($classes as $search => $class) {
if (strpos($vars['element']['#value'], $search) !== FALSE) {
$vars['element']['#attributes']['class'][] = $class;
+ $core_btn_found = TRUE;
break;
}
}
+ if(!$core_btn_found)
+ $vars['element']['#attributes']['class'][] = 'btn-default';
}
}
diff --git a/includes/theme.inc b/includes/theme.inc
index 9a9e45a..9c74665 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -126,7 +126,7 @@ function theme_bootstrap_links($variables) {
* theme_bootstrap_btn_dropdown
*/
function theme_bootstrap_btn_dropdown($variables) {
- $type_class = '';
+ $type_class = 'btn-default';
$sub_links ='';
$variables['attributes']['class'][] = 'btn-group';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment