Skip to content

Instantly share code, notes, and snippets.

@waako
Created February 3, 2012 18:15
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waako/1731493 to your computer and use it in GitHub Desktop.
Save waako/1731493 to your computer and use it in GitHub Desktop.
Drupal, get theme path in javascript
<?php
function theme_preprocess_page(&$variables) {
drupal_add_js('jQuery.extend(Drupal.settings, { "pathToTheme": "' . path_to_theme() . '" });', 'inline');
}
?>
@svict4
Copy link

svict4 commented Jun 6, 2018

To use the path, use Drupal.settings.basePath + Drupal.settings.pathToTheme + <path to whatever you need>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment