作为更具体采取对这个问题:Drupal的模块,检查是否节点类型
drupal jQuery 1.4 on specific pages
如何检查,一个模块内,一个节点是否是某种类型才能够对节点做某些事情。
感谢
上下文:
我想,这样,而不是“my_page”工作它的工作节点类型,以适应这个代码。
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);
}
}
}
谢谢。
谢谢我用上下文更新了我的问题。 – Mark 2010-06-07 15:19:31
然后我的第一个代码示例应该让你朝着正确的方向 – Kevin 2010-06-07 16:26:05