diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-12-19 19:09:52 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-12-19 19:09:52 +0000 |
commit | 7ae4e0b8469289b9b1bd05f45d9392fd80df5e9c (patch) | |
tree | 4766d4eeffd5bc5e03c99dc292a7fd50abeb8e5e /modules | |
parent | fd7e7eb55e244babc36daa177b4891b12670a58e (diff) | |
download | brdo-7ae4e0b8469289b9b1bd05f45d9392fd80df5e9c.tar.gz brdo-7ae4e0b8469289b9b1bd05f45d9392fd80df5e9c.tar.bz2 |
#192779 follow up by Lynn: only show enabled themes on block admin page *and* the admin theme (which might not be enabled)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/block/block.module | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/modules/block/block.module b/modules/block/block.module index 797f80030..e3d43dbbb 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -158,21 +158,27 @@ function block_menu() { ); $default = variable_get('theme_default', 'garland'); foreach (list_themes() as $key => $theme) { - // only show enabled themes - if ($theme->status) { - $items['admin/build/block/list/'. $key] = array( - 'title' => check_plain($theme->info['name']), - 'page arguments' => array($key), - 'type' => $key == $default ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, - 'weight' => $key == $default ? -10 : 0, - 'file' => 'block.admin.inc', - ); - } + $items['admin/build/block/list/'. $key] = array( + 'title' => check_plain($theme->info['name']), + 'page arguments' => array($key), + 'type' => $key == $default ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, + 'weight' => $key == $default ? -10 : 0, + 'file' => 'block.admin.inc', + 'access callback' => '_block_themes_access', + 'access arguments' => array($theme), + ); } 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(). * * Generates the administrator-defined blocks for display. |