Come un introito più specifica su questa questione:Drupal modulo, controllare se il tipo di nodo
drupal jQuery 1.4 on specific pages
Come posso controllare, all'interno di un modulo, se un nodo è un certo tipo di essere in grado di fai certe cose al nodo.
Grazie
Il contesto:
sto cercando di adattare questo codice in modo che piuttosto che lavorare su 'my_page' funziona su un tipo di nodo.
function MYMODULE_preprocess_page(&$variables, $arg = 'my_page', $delta=0) {
// I needed a one hit wonder. Can be altered to use function arguments
// to increase it's flexibility.
if(arg($delta) == $arg) {
$scripts = drupal_add_js();
$css = drupal_add_css();
// Only do this for pages that have JavaScript on them.
if (!empty($variables['scripts'])) {
$path = drupal_get_path('module', 'admin_menu');
unset($scripts['module'][$path . '/admin_menu.js']);
$variables['scripts'] = drupal_get_js('header', $scripts);
}
// Similar process for CSS but there are 2 Css realted variables.
// $variables['css'] and $variables['styles'] are both used.
if (!empty($variables['css'])) {
$path = drupal_get_path('module', 'admin_menu');
unset($css['all']['module'][$path . '/admin_menu.css']);
unset($css['all']['module'][$path . '/admin_menu.color.css']);
$variables['styles'] = drupal_get_css($css);
}
}
}
Grazie.
Grazie Ho aggiornato la mia domanda con il contesto. – Mark
Quindi il mio primo esempio di codice dovrebbe portarti nella giusta direzione – Kevin