Commit 7ae4e0b8 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#192779 follow up by Lynn: only show enabled themes on block admin page *and*...

#192779 follow up by Lynn: only show enabled themes on block admin page *and* the admin theme (which might not be enabled)
parent fd7e7eb5
...@@ -158,20 +158,26 @@ function block_menu() { ...@@ -158,20 +158,26 @@ function block_menu() {
); );
$default = variable_get('theme_default', 'garland'); $default = variable_get('theme_default', 'garland');
foreach (list_themes() as $key => $theme) { foreach (list_themes() as $key => $theme) {
// only show enabled themes $items['admin/build/block/list/'. $key] = array(
if ($theme->status) { 'title' => check_plain($theme->info['name']),
$items['admin/build/block/list/'. $key] = array( 'page arguments' => array($key),
'title' => check_plain($theme->info['name']), 'type' => $key == $default ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
'page arguments' => array($key), 'weight' => $key == $default ? -10 : 0,
'type' => $key == $default ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, 'file' => 'block.admin.inc',
'weight' => $key == $default ? -10 : 0, 'access callback' => '_block_themes_access',
'file' => 'block.admin.inc', 'access arguments' => array($theme),
); );
}
} }
return $items; return $items;
} }
/**
* Menu item access callback - only admin or enabled themes can be accessed
*/
function _block_themes_access($theme) {
return user_access('administer blocks') && ($theme->status || $theme->name == variable_get('admin_theme', '0'));
}
/** /**
* Implementation of hook_block(). * Implementation of hook_block().
* *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment