1
我在Drupal 7的视图的标题中放了一个“Global:link”。我想我可以把链接作为html放在Global:文本区域中。 如果用户不是管理员,我不希望他们看到此链接。所以,我试图把我的主题这段代码的template.php:如何在drupal 7的视图中取消设置标题字段?
// hide global text area in view header if user is not admin
function mytheme_views_pre_render(&$view) {
if ($view->name == 'taxonomy_term') {
dpm($view->name);
global $user;
// Check to see if $user has the administrator role or not.
if (!in_array('administrator', array_values($user->roles))) {
$header_item = $view->display_handler->get_option('header');
dpm($header_item['link']);
unset($header_item['link']);
}
}
}
}
..但我怎么在这个特定视图的头取消设置一个全球性的领域? 我上面的代码没有办法。 任何帮助将不胜感激!