Created
July 10, 2014 19:58
-
-
Save ritcheyer/387963d8554357d11435 to your computer and use it in GitHub Desktop.
Rather than have a giant if statement that is used for page-specific css and javascript, use the $path_alias provided by Drupal
This file contains 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
// TODO: there are better ways to do this. needs research | |
// maybe something like this: https://www.drupal.org/project/autoload_js | |
$path_alias = drupal_get_path_alias($_GET["q"]); | |
$theme_path = $base_url . '/' . drupal_get_path('theme', 'tesla_theme'); | |
/** | |
* DESCRIPTION: | |
* page-specific CSS added through this function based on the $path_alias | |
* AUTHOR: eritchey@teslamotors.com | |
*/ | |
$page_level_CSS = array( | |
'#tag' => 'link', | |
'#attributes' => array( | |
'href' => $theme_path . '/css/' . $path_alias . '.css', | |
'rel' => 'stylesheet', | |
'media' => 'all' | |
), | |
'#weight' => '-99995', | |
); | |
drupal_add_html_head($page_level_CSS, 'page_level_CSS'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment