I am creating a shortcut bar something like below, but unfortuntly it show up despite my wish that I could hide it for anonymous and administrator users/role. I want to display it for editor roles only. How do I achieve this? Thanks
function shortcat_permission() {
return array(
'administer shortcat' => array(
'title' => t('Administer shortcats'),
'restrict access' => TRUE,
),
);
}
function shortcat_page_alter(&$page) {
$page['page_top']['#pre_render'][] = 'shortcat_toolbar_pre_render';
}
function shortcat_renderables() {
$shortcut_set = array();
$shortcut_set['my_list'][] = array("#markup" =>"<ul>");
$shortcut_set['my_list'][] = array("#markup" =>"<li><a href='node/add' class='shlinks'>".t('Add Content')."</a></li>");
$shortcut_set['my_list'][] = array("#markup" =>"<li><a href='admin/content' class='shlinks'>".t('Find Content')."</li>");
$shortcut_set['my_list'][] = array("#markup" =>"</ul>");
return $shortcut_set;
}
function shortcat_toolbar_pre_render() {
$links = shortcat_renderables();
$links['#attached'] = array('css' => array(drupal_get_path('module', 'shortcat') . '/shortcat.css'));
$links['#prefix'] = '<div class="toolbar-shortcats">';
$links['#suffix'] = '</div>';
return $links;
}
I know you can make use of:
global $user;
if ($user->uid) {
display it here...
{
but this won't make the user access right accesible in People > Permissions