--- modules/block/block.admin.inc.613.orig 2008-11-24 06:00:02.000000000 +0000 +++ modules/block/block.admin.inc 2009-09-15 07:49:06.000000000 +0100 @@ -80,7 +80,7 @@ function block_admin_display_form(&$form if ($throttle) { $form[$key]['throttle'] = array('#type' => 'checkbox', '#default_value' => isset($block['throttle']) ? $block['throttle'] : FALSE); } - $form[$key]['configure'] = array('#value' => l(t('configure'), 'admin/build/block/configure/'. $block['module'] .'/'. $block['delta'])); + $form[$key]['configure'] = array('#value' => l(t('configure'), 'admin/build/block/configure/'. $block['module'] .'/'. $block['delta'] .'/'. $theme_key)); if ($block['module'] == 'block') { $form[$key]['delete'] = array('#value' => l(t('delete'), 'admin/build/block/delete/'. $block['delta'])); } @@ -144,12 +144,13 @@ function _block_compare($a, $b) { /** * Menu callback; displays the block configuration form. */ -function block_admin_configure(&$form_state, $module = NULL, $delta = 0) { +function block_admin_configure(&$form_state, $module = NULL, $delta = 0, $theme = NULL) { $form['module'] = array('#type' => 'value', '#value' => $module); $form['delta'] = array('#type' => 'value', '#value' => $delta); + $form['theme'] = array('#type' => 'value', '#value' => $theme); - $edit = db_fetch_array(db_query("SELECT pages, visibility, custom, title FROM {blocks} WHERE module = '%s' AND delta = '%s'", $module, $delta)); + $edit = db_fetch_array(db_query("SELECT pages, visibility, custom, title FROM {blocks} WHERE module = '%s' AND delta = '%s' AND theme = '%s'", $module, $delta, $theme)); $form['block_settings'] = array( '#type' => 'fieldset', @@ -273,7 +274,7 @@ function block_admin_configure_validate( function block_admin_configure_submit($form, &$form_state) { if (!form_get_errors()) { - db_query("UPDATE {blocks} SET visibility = %d, pages = '%s', custom = %d, title = '%s' WHERE module = '%s' AND delta = '%s'", $form_state['values']['visibility'], trim($form_state['values']['pages']), $form_state['values']['custom'], $form_state['values']['title'], $form_state['values']['module'], $form_state['values']['delta']); + db_query("UPDATE {blocks} SET visibility = %d, pages = '%s', custom = %d, title = '%s' WHERE module = '%s' AND delta = '%s' AND theme = '%s'", $form_state['values']['visibility'], trim($form_state['values']['pages']), $form_state['values']['custom'], $form_state['values']['title'], $form_state['values']['module'], $form_state['values']['delta'], $form_state['values']['theme']); db_query("DELETE FROM {blocks_roles} WHERE module = '%s' AND delta = '%s'", $form_state['values']['module'], $form_state['values']['delta']); foreach (array_filter($form_state['values']['roles']) as $rid) { db_query("INSERT INTO {blocks_roles} (rid, module, delta) VALUES (%d, '%s', '%s')", $rid, $form_state['values']['module'], $form_state['values']['delta']); @@ -282,6 +283,11 @@ function block_admin_configure_submit($f drupal_set_message(t('The block configuration has been saved.')); cache_clear_all(); $form_state['redirect'] = 'admin/build/block'; + // If the theme for the block being configured is not the default theme then return to the block listing for that theme, as that is where + // the 'configure' link was clicked from. Do not add the theme if it is the default, otherwise the url will not match and the tab will not be highlighted. + if ($form_state['values']['theme'] != variable_get('theme_default', '')) { + $form_state['redirect'] .= '/list/' . $form_state['values']['theme']; + } return; } }