summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Carver2013-04-01 02:27:30 (GMT)
committer Fabiano Sant'Ana2013-04-08 12:57:28 (GMT)
commit5d4f7ceef933421e95050232c0e8c3f770438891 (patch)
tree83e50558997126c79829caf0ef3ed07616eea125
parentb4534e9db3e7147bb2e29bb7d8e600ecbcd7520c (diff)
Issue #1957620 by Mark Carver: Refactor code to allow for either CDN or sub-theme source files.
-rw-r--r--README.txt8
-rw-r--r--bootstrap.info6
-rw-r--r--includes/theme.inc18
-rw-r--r--theme-settings.php1
4 files changed, 10 insertions, 23 deletions
diff --git a/README.txt b/README.txt
index 30ed6ec..d1a65a4 100644
--- a/README.txt
+++ b/README.txt
@@ -1,8 +1,6 @@
-Bootstrap theme for Drupal
+Bootstrap - A base theme for Drupal
-1. Download the Bootstrap library v2 (http://twitter.github.com/bootstrap/), make sure the resulting folder is named "bootstrap." If you are using the Github master branch, you will need to also find a way to compile the LESS and JS files since this module looks for bootstrap.css and bootstrap.js.
-2. Place the bootstrap folder inside the bootstrap theme folder or your subtheme folder: [path_to_themes]/bootstrap/bootstrap/js…
-3. Put any plugin files into [path_to_themes]/bootstrap/bootstrap/js/
-4. Make sure you have jQuery 1.7, which is available through the jQuery Update module (http://drupal.org/project/jquery_update/) 7.x-2.3 version or higher. You need to make sure the 1.7 version is selected on the configuration page for it to work.
+1. Bootstrap requires a minimum jQuery version of 1.7 to function properly. You can download and enable the ![jQuery Update](http://drupal.org/project/jquery_update/) module, 7.x-2.3 version or higher. Navigate to the configuration page and ensure that the minimum version selected is 1.7.
+2. By default, this base theme enables and uses a CDN for loading the Bootstrap library. If you disable this CDN, you will need to use an alternative solution for adding the necessary CSS and JS files from the Bootstrap library. This can be in the form creating a sub-theme or using a utility module.
Author: http://drupal.org/node/259843/committers \ No newline at end of file
diff --git a/bootstrap.info b/bootstrap.info
index 68350bc..487f809 100644
--- a/bootstrap.info
+++ b/bootstrap.info
@@ -10,14 +10,12 @@ regions[sidebar_first] = 'Primary'
regions[sidebar_second] = 'Secondary'
regions[footer] = 'Footer'
-stylesheets[all][] = bootstrap/css/bootstrap.css
-stylesheets[all][] = bootstrap/css/bootstrap-responsive.css
stylesheets[all][] = css/style.css
settings[toggle_name] = 0
settings[toggle_search] = 1
-settings[cdn_bootstrap] = 0
-settings[cdn_bootstrap_version] = 2.3.0
+settings[cdn_bootstrap] = 1
+settings[cdn_bootstrap_version] = 2.3.1
;Exclude
;javascript
diff --git a/includes/theme.inc b/includes/theme.inc
index 36296c5..1e15888 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -267,16 +267,10 @@ function bootstrap_status_messages($variables) {
* Implements hook_css_alter().
*/
function bootstrap_css_alter(&$css) {
- $theme_path = drupal_get_path('theme', 'bootstrap');
-
+ // Load excluded CSS files from theme.
$excludes = _bootstrap_alter(bootstrap_theme_get_info('exclude'), 'css');
-
+ // Add the Bootstrap CDN CSS files.
if (theme_get_setting('cdn_bootstrap')){
- //first add the existing bootstrap css to the exclude
- $excludes[$theme_path . '/bootstrap/css/bootstrap.css'] = FALSE;
- $excludes[$theme_path . '/bootstrap/css/bootstrap-responsive.css'] = FALSE ;
-
- //and then add the cdn css
$cdn_url = '//netdna.bootstrapcdn.com/twitter-bootstrap/'. theme_get_setting('cdn_bootstrap_version') .'/css/bootstrap-combined.min.css';
$css[$cdn_url]['data'] = $cdn_url;
$css[$cdn_url]['type'] = 'external';
@@ -294,24 +288,20 @@ function bootstrap_css_alter(&$css) {
* Implements hook_js_alter().
*/
function bootstrap_js_alter(&$js) {
- $theme_path = drupal_get_path('theme', 'bootstrap');
$files = array();
+ // Load excluded JS files from theme.
$excludes = _bootstrap_alter(bootstrap_theme_get_info('exclude'), 'js');
-
+
// If bootstrap_ui available, we should not add js from theme info file.
if (module_exists('bootstrap_ui')) {
libraries_load('bootstrap', 'minified');
- $excludes[drupal_get_path('theme', 'bootstrap') . '/bootstrap/js/bootstrap.js'] = array();
}
$js = array_diff_key($js, $excludes);
if (theme_get_setting('cdn_bootstrap')) {
$files[] = '//netdna.bootstrapcdn.com/twitter-bootstrap/'. theme_get_setting('cdn_bootstrap_version') .'/js/bootstrap.min.js';
}
- else {
- $files[] = $theme_path . '/bootstrap/js/bootstrap.js';
- }
// Rearrange / Add JS
$group = -50;
diff --git a/theme-settings.php b/theme-settings.php
index ca7e012..6740eea 100644
--- a/theme-settings.php
+++ b/theme-settings.php
@@ -46,6 +46,7 @@ function bootstrap_form_system_theme_settings_alter(&$form, $form_state, $form_i
'#type' => 'select',
'#title' => t('Bootstrap version'),
'#options' => array(
+ '2.3.1' => 'v2.3.1',
'2.3.0' => 'v2.3.0',
'2.2.2' => 'v2.2.2',
'2.2.1' => 'v2.2.1',