Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
http://www.bootstrapcdn.com/ provides free Bootstrap hosting. This would be extremely valuable for Drupal distros that cannot package Bootstrap as part of the download due to licensing issues (detailed here: https://github.com/twitter/bootstrap/issues/2054) and would allow some users to skip a step.
This should be fairly easy to do:
function hook_preprocess_page(&$vars) {
// Check for https and set $protocol to either 'http' or 'https'
drupal_add_js($protocol . '://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js', 'external');
drupal_add_css($protocol . '://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css', 'external');
}
Wrap that with a conditional for the theme setting and you're all set.
Comment | File | Size | Author |
---|---|---|---|
#3 | example_cdn_settings.patch | 1.58 KB | frankbaele |
Comments
Comment #1
cweagansMight also consider integrating with the Bootswatch section of bootstrap cdn to allow end users to quickly customize colors and whatnot.
Comment #2
wundo CreditAttribution: wundo commentedI've split the bootswatch into a different issue: #1840374: Integrate with Bootswatch
Comment #3
frankbaele CreditAttribution: frankbaele commentedsomething like this ? its a PO patch so just too show
Comment #4
frankbaele CreditAttribution: frankbaele commentedhi i wrote a patch here : https://drupal.org/node/1846736
that also includes latest jquery through cdn and no conflict
Comment #5
frankbaele CreditAttribution: frankbaele commentedComment #6
cweagansUh, no. Your issue is newer than this one. Mark yours as a duplicate.
Comment #7
wundo CreditAttribution: wundo commented#1846736: Remove jQuery CDN setting in favor of using jQuery Update module is fixed, cweagans, could you take a look at it and confirm that it implements everything discussed in this one?
Comment #8
cweagansLooking at the other issue, I'm choosing to pick my battles and because of the changes in the other issue, I no longer care about this theme.