diff --git modules/block/block.admin.inc modules/block/block.admin.inc index 9c4ed13..a62d1ff 100644 --- modules/block/block.admin.inc +++ modules/block/block.admin.inc @@ -23,7 +23,7 @@ function block_admin_demo($theme = NULL) { */ function block_admin_display($theme = NULL) { global $theme_key; - + drupal_theme_initialize(); if (!isset($theme)) { @@ -138,14 +138,14 @@ function block_admin_display_form_submit($form, &$form_state) { */ function _block_compare($a, $b) { global $theme_key; - + // Theme should be set before calling this function, or the current theme // is being used. $theme = &drupal_static(__FUNCTION__ . ':theme'); if (!isset($theme)) { $theme = $theme_key; } - + $regions = &drupal_static(__FUNCTION__ . ':regions'); // We need the region list to correctly order by region. if (!isset($regions)) { @@ -224,7 +224,7 @@ function block_admin_configure($form, &$form_state, $module = NULL, $delta = 0) ':delta' => $delta, ':theme' => $key, ))->fetchField(); - + $form['regions'][$key] = array( '#type' => 'select', '#title' => t('!theme region', array('!theme' => $theme->info['name'])), @@ -456,12 +456,12 @@ function block_add_block_form_submit($form, &$form_state) { 'visibility' => (int) $form_state['values']['visibility'], 'pages' => trim($form_state['values']['pages']), 'custom' => (int) $form_state['values']['custom'], - 'title' => $form_state['values']['title'], + 'title' => $form_state['values']['title'], 'module' => $form_state['values']['module'], - 'theme' => $theme->name, + 'theme' => $theme->name, 'status' => 0, 'weight' => 0, - 'delta' => $delta, + 'delta' => $delta, 'cache' => DRUPAL_NO_CACHE, )); } @@ -487,9 +487,10 @@ function block_add_block_form_submit($form, &$form_state) { )); } $query->execute(); - + // Store regions per theme for this block foreach ($form_state['values']['regions'] as $theme => $region) { + $assigned = TRUE; db_merge('block') ->key(array('theme' => $theme, 'delta' => $delta, 'module' => $form_state['values']['module'])) ->fields(array( @@ -501,6 +502,9 @@ function block_add_block_form_submit($form, &$form_state) { } drupal_set_message(t('The block has been created.')); + if ($assigned) { + drupal_set_message(t('The block has not yet assigned to a region. Manage disabled blocks to move the new block to a region as demonstrated on this page. ')); + } cache_clear_all(); $form_state['redirect'] = 'admin/structure/block'; } @@ -545,7 +549,7 @@ function block_custom_block_delete_submit($form, &$form_state) { function template_preprocess_block_admin_display_form(&$variables) { $block_regions = system_region_list($variables['form']['edited_theme']['#value'], REGIONS_VISIBLE); - $variables['block_regions'] = $block_regions + array(BLOCK_REGION_NONE => t('Disabled')); + $variables['block_regions'] = $block_regions + array(BLOCK_REGION_NONE => t('Disabled blocks')); foreach ($block_regions as $key => $value) { // Initialize an empty array for the region. diff --git modules/block/block.module modules/block/block.module index ee9d9db..64bfddc 100644 --- modules/block/block.module +++ modules/block/block.module @@ -32,11 +32,11 @@ function block_help($path, $arg) { case 'admin/structure/block/add': return '
' . t('Use this page to create a new custom block. New blocks are disabled by default, and must be moved to a region on the blocks administration page to be visible.', array('@blocks' => url('admin/structure/block'))) . '
'; } - if ($arg[0] == 'admin' && $arg[1] == 'structure' && $arg['2'] == 'block' && (empty($arg[3]) || $arg[3] == 'list')) { + if ($arg[0] == 'admin' && $arg[1] == 'structure' && $arg['2'] == 'block' && (empty($arg[3]) || $arg[3] == 'list')) { $demo_theme = !empty($arg[4]) ? $arg[4] : variable_get('theme_default', 'garland'); $themes = list_themes(); - $output = '' . t('This page provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the Save blocks button at the bottom of the page. Click the configure link next to each block to configure its specific title and visibility settings.') . '
'; - $output .= '' . l(t('Demonstrate block regions (@theme)', array('@theme' => $themes[$demo_theme]->info['name'])), 'admin/structure/block/demo/' . $demo_theme) . '
'; + $output = '' . t('Assign blocks to appear in regions demonstrated on this page, as listed below. Drag and drop to rearrange their order. Changes appear after you save. ') . '
'; + $output .= '' . t('Click the configure link next to each block to configure settings. Manage disabled blocks at the bottom of this page. Add a custom block.', array('@add-block' => url('admin/structure/block/add'))) . '
'; return $output; return $output; } } @@ -242,7 +242,7 @@ function block_page_build(&$page) { if ($item['path'] == 'admin/structure/block/demo/' . $theme) { $visible_regions = array_keys(system_region_list($theme, REGIONS_VISIBLE)); foreach ($visible_regions as $region) { - $description = '