diff --git a/includes/theme.inc b/includes/theme.inc
index ac3533f..4ab2d99 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -281,7 +281,11 @@ function bootstrap_css_alter(&$css) {
// Add Bootstrap CDN file and overrides.
if (theme_get_setting('bootstrap_cdn')){
// Add CDN.
- $cdn = '//netdna.bootstrapcdn.com/bootstrap/'. theme_get_setting('bootstrap_cdn') .'/css/bootstrap.min.css';
+ if(theme_get_setting('bootstrap_bootswatch')) {
+ $cdn = '//netdna.bootstrapcdn.com/bootswatch/'. theme_get_setting('bootstrap_cdn') .'/'.theme_get_setting('bootstrap_bootswatch_theme').'/bootstrap.min.css';
+ } else {
+ $cdn = '//netdna.bootstrapcdn.com/bootstrap/'. theme_get_setting('bootstrap_cdn') .'/css/bootstrap.min.css';
+ }
$css[$cdn] = array(
'data' => $cdn,
'type' => 'external',
diff --git a/theme-settings.php b/theme-settings.php
index 7652b44..f2aef8f 100644
--- a/theme-settings.php
+++ b/theme-settings.php
@@ -25,6 +25,33 @@ function bootstrap_form_system_theme_settings_alter(&$form, $form_state, $form_i
'#description' => t('Use !bootstrapcdn to serve the Bootstrap framework files. Enabling this setting will prevent this theme from attempting to load any Bootstrap framework files locally.', array('!bootstrapcdn' => l('BootstrapCDN', 'http://bootstrapcdn.com', array('external' => TRUE)))) . '
' . t('WARNING: Using this content distribution network will give you a performance boost but will also make you dependant on a third party who has no obligations towards you concerning uptime and service quality.') . '
',
);
+ $bootswatch_themes = array();
+ $bootswatch_api = drupal_json_decode(drupal_http_request('http://api.bootswatch.com/3/')->data);
+ foreach ($bootswatch_api['themes'] AS $val) {
+ $bootswatch_themes[strtolower($val['name'])] = $val['name'];
+ }
+
+ $form['bootstrap']['bootstrap_bootswatch'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Use Bootswatch to load a bootstrap theme.'),
+ '#default_value' => theme_get_setting('bootstrap_bootswatch'),
+ '#description' => t('Use Bootswatch to load a Bootstrap Theme from !bootstrapcdn ', array('!bootstrapcdn' => l('BootstrapCDN', 'http://bootstrapcdn.com', array('external' => TRUE)))),
+ );
+
+ $form['bootstrap']['bootstrap_bootswatch_theme'] = array(
+ '#type' => 'select',
+ '#title' => t('Bootswatch Theme'),
+ '#options' => $bootswatch_themes,
+ '#default_value' => theme_get_setting('bootstrap_bootswatch_theme'),
+ '#description' => t('Use !bootstrapcdn to serve a Bootswatch Theme. Choose Bootswatch Theme here.', array('!bootstrapcdn' => l('BootstrapCDN', 'http://bootstrapcdn.com', array('external' => TRUE)))) . '' . t('WARNING: Using this content distribution network will give you a performance boost but will also make you dependant on a third party who has no obligations towards you concerning uptime and service quality.') . '
',
+ '#states' => array(
+ 'invisible' => array(
+ ':input[name="bootstrap_bootswatch"]' => array('checked' => FALSE),
+ ),
+ ),
+ );
+ //$form['#attached']['js'] = array(drupal_get_path('theme', 'bootstrap') . '/js/bootswatch.admin.js');
+
$form['bootstrap']['bootstrap_rebuild_registry'] = array(
'#type' => 'checkbox',
'#title' => t('Rebuild theme registry on every page.'),