Created
June 18, 2010 18:10
-
-
Save kidsil/443992 to your computer and use it in GitHub Desktop.
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
//Add this at the start of preprocess_page to add a JS when you ADD or EDIT a certain content type. | |
if (arg(0) == 'node' && ((arg(1) == 'add' && arg(2) == 'contenttype') || ($vars['node']->type == 'contenttype' && arg(2) == 'edit'))) { | |
// Add your js file as usual | |
drupal_add_js('YOURJAVASCRIPT', 'theme'); | |
$vars['scripts'] = drupal_get_js(); | |
// Ensure that the addition has any effect by repopulating the scripts variable | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment