summaryrefslogtreecommitdiff
path: root/modules/block
diff options
context:
space:
mode:
Diffstat (limited to 'modules/block')
-rw-r--r--modules/block/block.admin.inc11
-rw-r--r--modules/block/block.module22
2 files changed, 21 insertions, 12 deletions
diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc
index 455b48b38..a1e65457d 100644
--- a/modules/block/block.admin.inc
+++ b/modules/block/block.admin.inc
@@ -10,11 +10,6 @@
* Menu callback for admin/structure/block.
*/
function block_admin_display($theme = NULL) {
- global $custom_theme;
-
- // If non-default theme configuration has been selected, set the custom theme.
- $custom_theme = isset($theme) ? $theme : variable_get('theme_default', 'garland');
-
// Fetch and sort blocks.
$blocks = _block_rehash();
usort($blocks, '_block_compare');
@@ -26,14 +21,10 @@ function block_admin_display($theme = NULL) {
* Generate main blocks administration form.
*/
function block_admin_display_form($form, &$form_state, $blocks, $theme = NULL) {
- global $theme_key, $custom_theme;
+ global $theme_key;
drupal_add_css(drupal_get_path('module', 'block') . '/block.css', array('preprocess' => FALSE));
- // If non-default theme configuration has been selected, set the custom theme.
- $custom_theme = isset($theme) ? $theme : variable_get('theme_default', 'garland');
- drupal_theme_initialize();
-
$block_regions = system_region_list($theme_key, REGIONS_VISIBLE) + array(BLOCK_REGION_NONE => '<' . t('none') . '>');
// Weights range from -delta to +delta, so delta should be at least half
diff --git a/modules/block/block.module b/modules/block/block.module
index 887366387..66aed9651 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -76,6 +76,7 @@ function block_menu() {
'description' => 'Configure what block content appears in your site\'s sidebars and other regions.',
'page callback' => 'block_admin_display',
'access arguments' => array('administer blocks'),
+ 'theme callback' => '_block_custom_theme',
'file' => 'block.admin.inc',
);
$items['admin/structure/block/list'] = array(
@@ -123,6 +124,8 @@ function block_menu() {
'weight' => $key == $default ? -10 : 0,
'access callback' => '_block_themes_access',
'access arguments' => array($theme),
+ 'theme callback' => '_block_custom_theme',
+ 'theme arguments' => array($key),
'file' => 'block.admin.inc',
);
}
@@ -133,8 +136,23 @@ function block_menu() {
* Menu item access callback - only admin or enabled themes can be accessed.
*/
function _block_themes_access($theme) {
- $admin_theme = variable_get('admin_theme');
- return user_access('administer blocks') && ($theme->status || ($admin_theme && ($theme->name == $admin_theme)));
+ return user_access('administer blocks') && drupal_theme_access($theme);
+}
+
+/**
+ * Theme callback for the block configuration pages.
+ *
+ * @param $theme
+ * The theme whose blocks are being configured. If not set, the default theme
+ * is assumed.
+ * @return
+ * The theme that should be used for the block configuration page, or NULL
+ * to indicate that the default theme should be used.
+ */
+function _block_custom_theme($theme = NULL) {
+ // We return exactly what was passed in, to guarantee that the page will
+ // always be displayed using the theme whose blocks are being configured.
+ return $theme;
}
/**