Last active
November 2, 2019 02:11
-
-
Save robdecker/5561527 to your computer and use it in GitHub Desktop.
[Put the path to the theme in Drupal.settings for use in javascript files] #d7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mytheme_preprocess_page(&$vars) { | |
// Add the path to this theme to Drupal.settings | |
$setting['pathToTheme'] = path_to_theme(); | |
drupal_add_js($setting, 'setting'); | |
} | |
// OR: | |
function mytheme_preprocess_page(&$vars) { | |
// Add the path to this theme to Drupal.settings | |
drupal_add_js('jQuery.extend(Drupal.settings, { "pathToTheme": "' . path_to_theme() . '" });', 'inline'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yepnope({ | |
test: Modernizr.touch, | |
yep: '/' + Drupal.settings.pathToTheme + '/js/hammer.js' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment