I wondering how I may hide some sections on the administration configuration page? I would like to hide some sections entirely for instance the media
section and then only remove certain items for others, under the system
section I only like to remove the cron
item.
I tried to alter the admin/config
page using hook_admin_paths_alter()
and hook_preprocess_page()
but without any luck. Would be nice if some one could point me in the right direction on how to achive this.
function MODULE_admin_paths_alter(&$paths) {
// hide some paths
$paths['admin/config/system/cron'] = FALSE;
}
function MODULE_preprocess_page(&$variables) {
if(path_is_admin(current_path())) {
// I don't know how to modify the markup of the page
// tried to add a template called page--admin--config.tpl.php but
// without any luck
}
}
In the end I used @Captain Pants solution:
function pe_admin_permission() {
return array(
'access extended config' => array(
'title' => t('Access Extended Configurations'),
'description' => t('Gives a user access to extended configuration pages.'),
'restrict access' => TRUE,
),
);
}
function pe_admin_menu_alter(&$items) {
// add all items you would like to hide here
// if you hide all items in a specific section the entire block
// will be removed
$sections = array(
'admin/config/system/cron',
'admin/config/system/actions',
'admin/config/system/mimemail',
'admin/config/system/mailsystem',
'admin/config/date/date_popup',
);
// loop through each item you would like to hide
foreach($sections as $section) {
$items[$section]['access callback'] = 'user_access';
$items[$section]['access arguments'] = array('access extended config');
}
}