diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-08-30 00:22:03 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-08-30 00:22:03 +0000 |
commit | 410fcdc718391005eb729855cceb06cde05cd758 (patch) | |
tree | e5abb679216eff264b576effd371babd16c90a91 /modules | |
parent | 10fca34cf15638eb63b6d147d448a52c73bf4baa (diff) | |
download | brdo-410fcdc718391005eb729855cceb06cde05cd758.tar.gz brdo-410fcdc718391005eb729855cceb06cde05cd758.tar.bz2 |
#761956 by David_Rothstein, Xen, sun, tstoeckler, Bojhan, zzolo, yoroy, jenlampton, linclark, BarisW: Fixed Dashboard blocks and regions should not appear on the main blocks configuration page.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/aggregator/aggregator.test | 4 | ||||
-rw-r--r-- | modules/block/block.admin.inc | 132 | ||||
-rw-r--r-- | modules/block/block.test | 12 | ||||
-rw-r--r-- | modules/blog/blog.test | 2 | ||||
-rw-r--r-- | modules/book/book.test | 2 | ||||
-rw-r--r-- | modules/comment/comment.test | 2 | ||||
-rw-r--r-- | modules/dashboard/dashboard.css | 5 | ||||
-rw-r--r-- | modules/dashboard/dashboard.module | 145 | ||||
-rw-r--r-- | modules/forum/forum.test | 4 | ||||
-rw-r--r-- | modules/locale/locale.test | 2 | ||||
-rw-r--r-- | modules/menu/menu.test | 2 | ||||
-rw-r--r-- | modules/node/node.test | 4 | ||||
-rw-r--r-- | modules/poll/poll.test | 2 | ||||
-rw-r--r-- | modules/profile/profile.test | 2 | ||||
-rw-r--r-- | modules/search/search.test | 6 | ||||
-rw-r--r-- | modules/system/system.test | 8 |
16 files changed, 252 insertions, 82 deletions
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test index 160f8ba6a..296de0677 100644 --- a/modules/aggregator/aggregator.test +++ b/modules/aggregator/aggregator.test @@ -787,10 +787,10 @@ class AggregatorRenderingTestCase extends AggregatorTestCase { ); $region = 'footer'; $edit = array(); - $edit[$block['module'] . '_' . $block['delta'] . '[region]'] = $region; + $edit['blocks[' . $block['module'] . '_' . $block['delta'] . '][region]'] = $region; // Check the feed block is available in the block list form. $this->drupalGet('admin/structure/block'); - $this->assertFieldByName($block['module'] . '_' . $block['delta'] . '[region]', '', 'Aggregator feed block is available for positioning.'); + $this->assertFieldByName('blocks[' . $block['module'] . '_' . $block['delta'] . '][region]', '', 'Aggregator feed block is available for positioning.'); // Position it. $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region))); diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index 8d9738326..8ba31e7f1 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -32,30 +32,61 @@ function block_admin_display($theme = NULL) { } // Fetch and sort blocks. + $blocks = block_admin_display_prepare_blocks($theme); + + return drupal_get_form('block_admin_display_form', $blocks, $theme); +} + +/** + * Prepares a list of blocks for display on the blocks administration page. + * + * @param $theme + * The machine-readable name of the theme whose blocks should be returned. + * + * @return + * An array of blocks, as returned by _block_rehash(), sorted by region in + * preparation for display on the blocks administration page. + * + * @see block_admin_display_form() + */ +function block_admin_display_prepare_blocks($theme) { $blocks = _block_rehash($theme); $compare_theme = &drupal_static('_block_compare:theme'); $compare_theme = $theme; usort($blocks, '_block_compare'); - - return drupal_get_form('block_admin_display_form', $blocks, $theme); + return $blocks; } /** * Form builder for the main blocks administration form. * * @param $blocks - * An array of all blocks returned by modules in hook_block_info(). + * An array of blocks, as returned by block_admin_display_prepare_blocks(). * @param $theme * A string representing the name of the theme to edit blocks for. + * @param $block_regions + * (optional) An array of regions in which the blocks will be allowed to be + * placed. Defaults to all visible regions for the theme whose blocks are + * being configured. In all cases, a dummy region for disabled blocks will + * also be displayed. + * + * @return + * An array representing the form definition. * - * @see block_admin_display_form_submit() * @ingroup forms + * @see block_admin_display_form_submit() */ -function block_admin_display_form($form, &$form_state, $blocks, $theme) { +function block_admin_display_form($form, &$form_state, $blocks, $theme, $block_regions = NULL) { drupal_add_css(drupal_get_path('module', 'block') . '/block.css'); - $block_regions = system_region_list($theme, REGIONS_VISIBLE) + array(BLOCK_REGION_NONE => '<' . t('none') . '>'); + // Get a list of block regions if one was not provided. + if (!isset($block_regions)) { + $block_regions = system_region_list($theme, REGIONS_VISIBLE); + } + + // We always add a region for disabled blocks. + $block_regions += array(BLOCK_REGION_NONE => '<' . t('none') . '>'); // Weights range from -delta to +delta, so delta should be at least half // of the amount of blocks present. This makes sure all blocks in the same @@ -63,46 +94,53 @@ function block_admin_display_form($form, &$form_state, $blocks, $theme) { $weight_delta = round(count($blocks) / 2); // Build the form tree. - $form['edited_theme'] = array('#type' => 'value', '#value' => $theme); - $form['#action'] = arg(4) ? url('admin/structure/block/list/' . $theme) : url('admin/structure/block'); + $form['edited_theme'] = array( + '#type' => 'value', + '#value' => $theme, + ); + $form['block_regions'] = array( + '#type' => 'value', + '#value' => $block_regions, + ); + $form['blocks'] = array(); $form['#tree'] = TRUE; foreach ($blocks as $i => $block) { $key = $block['module'] . '_' . $block['delta']; - $form[$key]['module'] = array( + $form['blocks'][$key]['module'] = array( '#type' => 'value', '#value' => $block['module'], ); - $form[$key]['delta'] = array( + $form['blocks'][$key]['delta'] = array( '#type' => 'value', '#value' => $block['delta'], ); - $form[$key]['info'] = array( + $form['blocks'][$key]['info'] = array( '#markup' => check_plain($block['info']), ); - $form[$key]['theme'] = array( + $form['blocks'][$key]['theme'] = array( '#type' => 'hidden', '#value' => $theme, ); - $form[$key]['weight'] = array( + $form['blocks'][$key]['weight'] = array( '#type' => 'weight', '#default_value' => $block['weight'], '#delta' => $weight_delta, '#title_display' => 'invisible', '#title' => t('Weight for @row', array('@row' => $block['info'])), ); - $form[$key]['region'] = array( + $form['blocks'][$key]['region'] = array( '#type' => 'select', '#default_value' => $block['region'], '#options' => $block_regions, ); - $form[$key]['configure'] = array( + $form['blocks'][$key]['configure'] = array( '#type' => 'link', '#title' => t('configure'), '#href' => 'admin/structure/block/manage/' . $block['module'] . '/' . $block['delta'] . '/configure', ); if ($block['module'] == 'block') { - $form[$key]['delete'] = array( + $form['blocks'][$key]['delete'] = array( '#type' => 'link', '#title' => t('delete'), '#href' => 'admin/structure/block/manage/' . $block['module'] . '/' . $block['delta'] . '/delete', @@ -110,7 +148,7 @@ function block_admin_display_form($form, &$form_state, $blocks, $theme) { } } // Do not allow disabling the main system content block. - unset($form['system_main']['region']['#options'][BLOCK_REGION_NONE]); + unset($form['blocks']['system_main']['region']['#options'][BLOCK_REGION_NONE]); $form['actions'] = array( '#tree' => FALSE, @@ -132,7 +170,7 @@ function block_admin_display_form($form, &$form_state, $blocks, $theme) { function block_admin_display_form_submit($form, &$form_state) { $txn = db_transaction(); - foreach ($form_state['values'] as $block) { + foreach ($form_state['values']['blocks'] as $block) { $block['status'] = (int) ($block['region'] != BLOCK_REGION_NONE); $block['region'] = $block['status'] ? $block['region'] : ''; db_update('block') @@ -590,7 +628,7 @@ function block_custom_block_delete_submit($form, &$form_state) { } /** - * Process variables for block-admin-display.tpl.php. + * Processes variables for block-admin-display-form.tpl.php. * * The $variables array contains the following arguments: * - $form @@ -599,11 +637,12 @@ function block_custom_block_delete_submit($form, &$form_state) { * @see theme_block_admin_display() */ function template_preprocess_block_admin_display_form(&$variables) { + $variables['block_regions'] = $variables['form']['block_regions']['#value']; + if (isset($variables['block_regions'][BLOCK_REGION_NONE])) { + $variables['block_regions'][BLOCK_REGION_NONE] = t('Disabled'); + } - $block_regions = system_region_list($variables['form']['edited_theme']['#value'], REGIONS_VISIBLE); - $variables['block_regions'] = $block_regions + array(BLOCK_REGION_NONE => t('Disabled')); - - foreach ($block_regions as $key => $value) { + foreach ($variables['block_regions'] as $key => $value) { // Initialize an empty array for the region. $variables['block_listing'][$key] = array(); } @@ -611,33 +650,28 @@ function template_preprocess_block_admin_display_form(&$variables) { // Initialize disabled blocks array. $variables['block_listing'][BLOCK_REGION_NONE] = array(); - // Set up to track previous region in loop. - $last_region = ''; - foreach (element_children($variables['form']) as $i) { - $block = &$variables['form'][$i]; - - // Only take form elements that are blocks. - if (isset($block['info'])) { - // Fetch region for current block. - $region = $block['region']['#default_value']; - - // Set special classes needed for table drag and drop. - $variables['form'][$i]['region']['#attributes']['class'] = array('block-region-select', 'block-region-' . $region); - $variables['form'][$i]['weight']['#attributes']['class'] = array('block-weight', 'block-weight-' . $region); - - $variables['block_listing'][$region][$i] = new stdClass(); - $variables['block_listing'][$region][$i]->row_class = !empty($block['#attributes']['class']) ? implode(' ', $block['#attributes']['class']) : ''; - $variables['block_listing'][$region][$i]->block_modified = !empty($block['#attributes']['class']) && in_array('block-modified', $block['#attributes']['class']); - $variables['block_listing'][$region][$i]->block_title = drupal_render($block['info']); - $variables['block_listing'][$region][$i]->region_select = drupal_render($block['region']) . drupal_render($block['theme']); - $variables['block_listing'][$region][$i]->weight_select = drupal_render($block['weight']); - $variables['block_listing'][$region][$i]->configure_link = drupal_render($block['configure']); - $variables['block_listing'][$region][$i]->delete_link = !empty($block['delete']) ? drupal_render($block['delete']) : ''; - $variables['block_listing'][$region][$i]->printed = FALSE; - - $last_region = $region; - } + // Add each block in the form to the appropriate place in the block listing. + foreach (element_children($variables['form']['blocks']) as $i) { + $block = &$variables['form']['blocks'][$i]; + + // Fetch the region for the current block. + $region = $block['region']['#default_value']; + + // Set special classes needed for table drag and drop. + $block['region']['#attributes']['class'] = array('block-region-select', 'block-region-' . $region); + $block['weight']['#attributes']['class'] = array('block-weight', 'block-weight-' . $region); + + $variables['block_listing'][$region][$i] = new stdClass(); + $variables['block_listing'][$region][$i]->row_class = !empty($block['#attributes']['class']) ? implode(' ', $block['#attributes']['class']) : ''; + $variables['block_listing'][$region][$i]->block_modified = !empty($block['#attributes']['class']) && in_array('block-modified', $block['#attributes']['class']); + $variables['block_listing'][$region][$i]->block_title = drupal_render($block['info']); + $variables['block_listing'][$region][$i]->region_select = drupal_render($block['region']) . drupal_render($block['theme']); + $variables['block_listing'][$region][$i]->weight_select = drupal_render($block['weight']); + $variables['block_listing'][$region][$i]->configure_link = drupal_render($block['configure']); + $variables['block_listing'][$region][$i]->delete_link = !empty($block['delete']) ? drupal_render($block['delete']) : ''; + $variables['block_listing'][$region][$i]->printed = FALSE; } $variables['form_submit'] = drupal_render_children($variables['form']); } + diff --git a/modules/block/block.test b/modules/block/block.test index ce8044ed3..4c92eb582 100644 --- a/modules/block/block.test +++ b/modules/block/block.test @@ -120,7 +120,7 @@ class BlockTestCase extends DrupalWebTestCase { // Set the created custom block to a specific region. $bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $custom_block['info']))->fetchField(); $edit = array(); - $edit['block_' . $bid . '[region]'] = $this->regions[1]; + $edit['blocks[block_' . $bid . '][region]'] = $this->regions[1]; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); // Confirm that the custom block is being displayed using configured text format. @@ -215,7 +215,7 @@ class BlockTestCase extends DrupalWebTestCase { // Set the block to the disabled region. $edit = array(); - $edit[$block['module'] . '_' . $block['delta'] . '[region]'] = '-1'; + $edit['blocks[' . $block['module'] . '_' . $block['delta'] . '][region]'] = '-1'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); // Confirm that the block was moved to the proper region. @@ -228,7 +228,7 @@ class BlockTestCase extends DrupalWebTestCase { // For convenience of developers, put the navigation block back. $edit = array(); - $edit[$block['module'] . '_' . $block['delta'] . '[region]'] = $this->regions[1]; + $edit['blocks[' . $block['module'] . '_' . $block['delta'] . '][region]'] = $this->regions[1]; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertText(t('The block settings have been updated.'), t('Block successfully move to first sidebar region.')); @@ -239,7 +239,7 @@ class BlockTestCase extends DrupalWebTestCase { function moveBlockToRegion($block, $region) { // Set the created block to a specific region. $edit = array(); - $edit[$block['module'] . '_' . $block['delta'] . '[region]'] = $region; + $edit['blocks[' . $block['module'] . '_' . $block['delta'] . '][region]'] = $region; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); // Confirm that the block was moved to the proper region. @@ -418,7 +418,7 @@ class BlockCacheTestCase extends DrupalWebTestCase { variable_set('block_cache', TRUE); // Enable our test block. - $edit['block_test_test_cache[region]'] = 'sidebar_first'; + $edit['blocks[block_test_test_cache][region]'] = 'sidebar_first'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); } @@ -594,7 +594,7 @@ class BlockHTMLIdTestCase extends DrupalWebTestCase { $this->drupalLogin($this->admin_user); // Enable our test block. - $edit['block_test_test_html_id[region]'] = 'sidebar_first'; + $edit['blocks[block_test_test_html_id][region]'] = 'sidebar_first'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); // Make sure the block has some content so it will appear diff --git a/modules/blog/blog.test b/modules/blog/blog.test index 500a9d74f..521f5f064 100644 --- a/modules/blog/blog.test +++ b/modules/blog/blog.test @@ -62,7 +62,7 @@ class BlogTestCase extends DrupalWebTestCase { $this->drupalLogin($this->big_user); // Enable the recent blog block. $edit = array(); - $edit['blog_recent[region]'] = 'sidebar_second'; + $edit['blocks[blog_recent][region]'] = 'sidebar_second'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertResponse(200); // Verify ability to change number of recent blog posts in block. diff --git a/modules/book/book.test b/modules/book/book.test index a544617d4..0f58a79d7 100644 --- a/modules/book/book.test +++ b/modules/book/book.test @@ -271,7 +271,7 @@ class BookBlockTestCase extends DrupalWebTestCase { // Set the block to a region to confirm block is availble. $edit = array(); - $edit['book_navigation[region]'] = 'footer'; + $edit['blocks[book_navigation][region]'] = 'footer'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.')); } diff --git a/modules/comment/comment.test b/modules/comment/comment.test index ba28b6ac2..2515a9693 100644 --- a/modules/comment/comment.test +++ b/modules/comment/comment.test @@ -1014,7 +1014,7 @@ class CommentBlockFunctionalTest extends CommentHelperCase { // Set the block to a region to confirm block is available. $edit = array( - 'comment_recent[region]' => 'sidebar_first', + 'blocks[comment_recent][region]' => 'sidebar_first', ); $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertText(t('The block settings have been updated.'), t('Block saved to first sidebar region.')); diff --git a/modules/dashboard/dashboard.css b/modules/dashboard/dashboard.css index 737cca6a4..b40eaba00 100644 --- a/modules/dashboard/dashboard.css +++ b/modules/dashboard/dashboard.css @@ -46,11 +46,6 @@ padding: 10px; } -#dashboard .canvas-content a { - color: #fff; - text-decoration: underline; -} - #dashboard #disabled-blocks .ui-sortable { padding: 0; background-color: #777; diff --git a/modules/dashboard/dashboard.module b/modules/dashboard/dashboard.module index 02f417707..041934fb4 100644 --- a/modules/dashboard/dashboard.module +++ b/modules/dashboard/dashboard.module @@ -18,6 +18,12 @@ function dashboard_help($path, $arg) { $output .= '<dd>' . t('By enabling blocks such as <em>Recent blog posts</em>, <em>New forum topics</em> and <em>Recent comments</em>, site users can view newly added site content at a glance.') . '</dd>'; $output .= '</dl>'; return $output; + + case 'admin/structure/dashboard': + // @todo This assumes the current page is being displayed using the same + // theme that the dashboard is displayed in. + $output = '<p>' . t('Rearrange blocks for display on the <a href="@dashboard-url">dashboard</a>. Disabling a block makes it available on the main <a href="@blocks-url">blocks administration page</a>.', array('@dashboard-url' => url('admin/dashboard'), '@blocks-url' => url("admin/structure/block/list/{$GLOBALS['theme_key']}"))) . '</p>'; + return $output; } } @@ -25,6 +31,12 @@ function dashboard_help($path, $arg) { * Implements hook_menu(). */ function dashboard_menu() { + $items['admin/structure/dashboard'] = array( + 'title' => 'Dashboard', + 'description' => "Configure which blocks can be shown on the dashboard.", + 'page callback' => 'dashboard_admin_blocks', + 'access arguments' => array('administer blocks'), + ); $items['admin/dashboard'] = array( 'title' => 'Dashboard', 'description' => 'View and customize your dashboard', @@ -59,6 +71,7 @@ function dashboard_menu() { 'access arguments' => array('administer blocks'), 'type' => MENU_CALLBACK, ); + return $items; } @@ -192,10 +205,31 @@ function dashboard_theme() { 'dashboard_disabled_block' => array( 'variables' => array('block' => NULL), ), + 'dashboard_admin_display_form' => array( + // When building the form for configuring dashboard blocks, reuse the + // Block module's template for the main block configuration form. + 'template' => 'block-admin-display-form', + 'path' => drupal_get_path('module', 'block'), + 'file' => 'block.admin.inc', + 'render element' => 'form', + ), ); } /** + * Implements hook_forms(). + */ +function dashboard_forms() { + // Reroute the dashboard configuration form to the main blocks administration + // form. This allows us to distinguish them by form ID in hook_form_alter(). + $forms['dashboard_admin_display_form'] = array( + 'callback' => 'block_admin_display_form', + ); + + return $forms; +} + +/** * Dashboard page callback. * * @param $launch_customize @@ -225,7 +259,7 @@ function dashboard_admin($launch_customize = FALSE) { ); $build = array( '#theme' => 'dashboard_admin', - '#message' => t('To customize the dashboard page, move blocks to the dashboard regions on the <a href="@blocks">Blocks administration page</a>, or enable JavaScript on this page to use the drag-and-drop interface.', array('@blocks' => url('admin/structure/block'))), + '#message' => t('To customize the dashboard page, move blocks to the dashboard regions on the <a href="@dashboard">Dashboard administration page</a>, or enable JavaScript on this page to use the drag-and-drop interface.', array('@dashboard' => url('admin/structure/dashboard'))), '#access' => user_access('administer blocks'), '#attached' => array( 'js' => array( @@ -239,6 +273,113 @@ function dashboard_admin($launch_customize = FALSE) { } /** + * Menu page callback: builds the page for administering dashboard blocks. + * + * This page reuses the Block module's administration form but limits editing + * to blocks that are available to appear on the dashboard. + * + * @see block_admin_display() + * @see block_admin_display_form() + * @see dashboard_form_dashboard_admin_display_form_alter() + * @see template_preprocess_dashboard_admin_display_form() + */ +function dashboard_admin_blocks() { + global $theme_key; + drupal_theme_initialize(); + drupal_set_title(t('Configure available dashboard blocks')); + module_load_include('inc', 'block', 'block.admin'); + + // Prepare the blocks for the current theme, and remove those that are + // currently displayed in non-dashboard regions. + // @todo This assumes the current page is being displayed using the same + // theme that the dashboard is displayed in. + $blocks = block_admin_display_prepare_blocks($theme_key); + $dashboard_regions = dashboard_region_descriptions(); + $regions_to_remove = array_diff_key(system_region_list($theme_key, REGIONS_VISIBLE), $dashboard_regions); + foreach ($blocks as $id => $block) { + if (isset($regions_to_remove[$block['region']])) { + unset($blocks[$id]); + } + } + + // Pass in the above blocks and dashboard regions to the form, so that only + // dashboard-related regions will be displayed. + return drupal_get_form('dashboard_admin_display_form', $blocks, $theme_key, $dashboard_regions); +} + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function dashboard_form_block_admin_display_form_alter(&$form, &$form_state) { + // Hide dashboard regions (and any blocks placed within them) from the block + // administration form and from the options list on that form. + $dashboard_regions = dashboard_region_descriptions(); + $form['block_regions']['#value'] = array_diff_key($form['block_regions']['#value'], $dashboard_regions); + foreach (element_children($form['blocks']) as $i) { + $block = &$form['blocks'][$i]; + if (isset($block['region']['#default_value']) && isset($dashboard_regions[$block['region']['#default_value']])) { + $block['#access'] = FALSE; + } + elseif (isset($block['region']['#options'])) { + $block['region']['#options'] = array_diff_key($block['region']['#options'], $dashboard_regions); + } + } +} + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function dashboard_form_dashboard_admin_display_form_alter(&$form, &$form_state) { + // Inherit the submit handler from the main block administration form. + $form['#submit'][] = 'block_admin_display_form_submit'; + + // Redirect the 'configure' and 'delete' links on each block back to the + // dashboard blocks administration page. + foreach ($form['blocks'] as &$block) { + if (isset($block['configure']['#href'])) { + $block['configure']['#options']['query']['destination'] = 'admin/structure/dashboard'; + } + if (isset($block['delete']['#href'])) { + $block['delete']['#options']['query']['destination'] = 'admin/structure/dashboard'; + } + } +} + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function dashboard_form_block_admin_configure_alter(&$form, &$form_state) { + global $theme_key; + drupal_theme_initialize(); + // Hide the dashboard regions from the region select list on the block + // configuration form, for all themes except the current theme (since the + // other themes do not display the dashboard). + // @todo This assumes the current page is being displayed using the same + // theme that the dashboard is displayed in. + $dashboard_regions = dashboard_region_descriptions(); + foreach (element_children($form['regions']) as $region_name) { + $region = &$form['regions'][$region_name]; + if ($region_name != $theme_key && isset($region['#options'])) { + $region['#options'] = array_diff_key($region['#options'], $dashboard_regions); + } + } +} + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function dashboard_form_block_add_block_form_alter(&$form, &$form_state) { + dashboard_form_block_admin_configure_alter($form, $form_state); +} + +/** + * Preprocesses variables for block-admin-display-form.tpl.php. + */ +function template_preprocess_dashboard_admin_display_form(&$variables) { + template_preprocess_block_admin_display_form($variables); +} + +/** * Determines if the dashboard should be displayed on the current page. * * This function checks if the user is currently viewing the dashboard and has @@ -464,7 +605,7 @@ function theme_dashboard_region($variables) { */ function theme_dashboard_disabled_blocks($variables) { extract($variables); - $output = '<div class="canvas-content"><p>' . t('Drag and drop these blocks to the columns below. Changes are automatically saved.') . '</p>'; + $output = '<div class="canvas-content"><p>' . t('Drag and drop these blocks to the columns below. Changes are automatically saved. More options are available on the <a href="@dashboard-url">configuration page</a>.', array('@dashboard-url' => url('admin/structure/dashboard'))) . '</p>'; $output .= '<div id="disabled-blocks"><div class="region disabled-blocks clearfix">'; foreach ($blocks as $block) { $output .= theme('dashboard_disabled_block', array('block' => $block)); diff --git a/modules/forum/forum.test b/modules/forum/forum.test index 1cd7dfc6d..786913ace 100644 --- a/modules/forum/forum.test +++ b/modules/forum/forum.test @@ -145,14 +145,14 @@ class ForumTestCase extends DrupalWebTestCase { // Enable the active forum block. $edit = array(); - $edit['forum_active[region]'] = 'sidebar_second'; + $edit['blocks[forum_active][region]'] = 'sidebar_second'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertResponse(200); $this->assertText(t('The block settings have been updated.'), t('Active forum topics forum block was enabled')); // Enable the new forum block. $edit = array(); - $edit['forum_new[region]'] = 'sidebar_second'; + $edit['blocks[forum_new][region]'] = 'sidebar_second'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertResponse(200); $this->assertText(t('The block settings have been updated.'), t('[New forum topics] Forum block was enabled')); diff --git a/modules/locale/locale.test b/modules/locale/locale.test index b2f36c6e2..8e3ceba51 100644 --- a/modules/locale/locale.test +++ b/modules/locale/locale.test @@ -1160,7 +1160,7 @@ class LocaleLanguageSwitchingFunctionalTest extends DrupalWebTestCase { // Enable the language switching block. $language_type = LANGUAGE_TYPE_INTERFACE; $edit = array( - "locale_{$language_type}[region]" => 'sidebar_first', + "blocks[locale_{$language_type}][region]" => 'sidebar_first', ); $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); diff --git a/modules/menu/menu.test b/modules/menu/menu.test index da4fa88df..1fa76f188 100644 --- a/modules/menu/menu.test +++ b/modules/menu/menu.test @@ -157,7 +157,7 @@ class MenuTestCase extends DrupalWebTestCase { // Enable the custom menu block. $menu_name = 'menu-' . $menu_name; // Drupal prepends the name with 'menu-'. $edit = array(); - $edit['menu_' . $menu_name . '[region]'] = 'sidebar_first'; + $edit['blocks[menu_' . $menu_name . '][region]'] = 'sidebar_first'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertResponse(200); $this->assertText(t('The block settings have been updated.'), t('Custom menu block was enabled')); diff --git a/modules/node/node.test b/modules/node/node.test index 69dded38b..f2d6952d6 100644 --- a/modules/node/node.test +++ b/modules/node/node.test @@ -634,7 +634,7 @@ class NodeBlockTestCase extends DrupalWebTestCase { // Set the block to a region to confirm block is available. $edit = array(); - $edit['node_syndicate[region]'] = 'footer'; + $edit['blocks[node_syndicate][region]'] = 'footer'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.')); } @@ -1398,7 +1398,7 @@ class NodeBlockFunctionalTest extends DrupalWebTestCase { // Set the block to a region to confirm block is available. $edit = array( - 'node_recent[region]' => 'sidebar_first', + 'blocks[node_recent][region]' => 'sidebar_first', ); $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertText(t('The block settings have been updated.'), t('Block saved to first sidebar region.')); diff --git a/modules/poll/poll.test b/modules/poll/poll.test index 061646492..23af858c2 100644 --- a/modules/poll/poll.test +++ b/modules/poll/poll.test @@ -265,7 +265,7 @@ class PollBlockTestCase extends PollTestCase { // Set the block to a region to confirm block is available. $edit = array(); - $edit['poll_recent[region]'] = 'footer'; + $edit['blocks[poll_recent][region]'] = 'footer'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.')); diff --git a/modules/profile/profile.test b/modules/profile/profile.test index 27b32d3db..3eb471fd8 100644 --- a/modules/profile/profile.test +++ b/modules/profile/profile.test @@ -397,7 +397,7 @@ class ProfileBlockTestCase extends ProfileTestCase { function testAuthorInformationBlock() { // Set the block to a region to confirm the block is availble. $edit = array(); - $edit['profile_author-information[region]'] = 'footer'; + $edit['blocks[profile_author-information][region]'] = 'footer'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.')); diff --git a/modules/search/search.test b/modules/search/search.test index b4c38312c..556a98a1f 100644 --- a/modules/search/search.test +++ b/modules/search/search.test @@ -559,7 +559,7 @@ class SearchBlockTestCase extends DrupalWebTestCase { // Set the block to a region to confirm block is availble. $edit = array(); - $edit['search_form[region]'] = 'footer'; + $edit['blocks[search_form][region]'] = 'footer'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.')); } @@ -570,7 +570,7 @@ class SearchBlockTestCase extends DrupalWebTestCase { function testBlock() { // Enable the block, and place it in the 'content' region so that it isn't // hidden on 404 pages. - $edit = array('search_form[region]' => 'content'); + $edit = array('blocks[search_form][region]' => 'content'); $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); // Test a normal search via the block form, from the front page. @@ -1137,7 +1137,7 @@ class SearchConfigSettingsForm extends DrupalWebTestCase { // Enable the search block. $edit = array(); - $edit['search_form[region]'] = 'content'; + $edit['blocks[search_form][region]'] = 'content'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); } diff --git a/modules/system/system.test b/modules/system/system.test index aff5749f7..9c2558de4 100644 --- a/modules/system/system.test +++ b/modules/system/system.test @@ -696,7 +696,7 @@ class AccessDeniedTestCase extends DrupalWebTestCase { // Log back in, set the custom 403 page to /user and remove the block $this->drupalLogin($this->admin_user); variable_set('site_403', 'user'); - $this->drupalPost('admin/structure/block', array('user_login[region]' => '-1'), t('Save blocks')); + $this->drupalPost('admin/structure/block', array('blocks[user_login][region]' => '-1'), t('Save blocks')); // Check that we can log in from the 403 page. $this->drupalLogout(); @@ -1165,7 +1165,7 @@ class SystemBlockTestCase extends DrupalWebTestCase { // Set the powered-by block to the footer region. $edit = array(); - $edit['system_powered-by[region]'] = 'footer'; + $edit['blocks[system_powered-by][region]'] = 'footer'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->assertText(t('The block settings have been updated.'), t('Block successfully moved to footer region.')); @@ -1175,7 +1175,7 @@ class SystemBlockTestCase extends DrupalWebTestCase { // Set the block to the disabled region. $edit = array(); - $edit['system_powered-by[region]'] = '-1'; + $edit['blocks[system_powered-by][region]'] = '-1'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); // Confirm that the block is hidden. @@ -1183,7 +1183,7 @@ class SystemBlockTestCase extends DrupalWebTestCase { // For convenience of developers, set the block to its default settings. $edit = array(); - $edit['system_powered-by[region]'] = 'footer'; + $edit['blocks[system_powered-by][region]'] = 'footer'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->drupalPost('admin/structure/block/manage/system/powered-by/configure', array('title' => ''), t('Save block')); } |