diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-07-08 03:41:27 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-07-08 03:41:27 +0000 |
commit | 8f5c296cc08ee58206d204f61fe13abbbe050baf (patch) | |
tree | df85fe532263b63fa5a911221a138a62440cfd5a /modules/block | |
parent | 893fba439bd0fa2d17075715a383a374ff2a4cc6 (diff) | |
download | brdo-8f5c296cc08ee58206d204f61fe13abbbe050baf.tar.gz brdo-8f5c296cc08ee58206d204f61fe13abbbe050baf.tar.bz2 |
#845742 by Damien Tournoud: Make Bartik the default core theme.
Diffstat (limited to 'modules/block')
-rw-r--r-- | modules/block/block.admin.inc | 2 | ||||
-rw-r--r-- | modules/block/block.module | 6 | ||||
-rw-r--r-- | modules/block/block.test | 42 |
3 files changed, 25 insertions, 25 deletions
diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index c42a9d004..16a8edb4a 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -228,7 +228,7 @@ function block_admin_configure($form, &$form_state, $module, $delta) { '#tree' => TRUE, ); - $theme_default = variable_get('theme_default', 'garland'); + $theme_default = variable_get('theme_default', 'bartik'); foreach (list_themes() as $key => $theme) { // Only display enabled themes if ($theme->status) { diff --git a/modules/block/block.module b/modules/block/block.module index 1593f6ff6..1dc32f6af 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -64,7 +64,7 @@ function block_help($path, $arg) { return '<p>' . t('Use this page to create a new custom block.') . '</p>'; } 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'); + $demo_theme = !empty($arg[4]) ? $arg[4] : variable_get('theme_default', 'bartik'); $themes = list_themes(); $output = '<p>' . 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 <em>Save blocks</em> button at the bottom of the page. Click the <em>configure</em> link next to each block to configure its specific title and visibility settings.') . '</p>'; $output .= '<p>' . l(t('Demonstrate block regions (@theme)', array('@theme' => $themes[$demo_theme]->info['name'])), 'admin/structure/block/demo/' . $demo_theme) . '</p>'; @@ -104,7 +104,7 @@ function block_permission() { * Implements hook_menu(). */ function block_menu() { - $default_theme = variable_get('theme_default', 'garland'); + $default_theme = variable_get('theme_default', 'bartik'); $items['admin/structure/block'] = array( 'title' => 'Blocks', 'description' => 'Configure what block content appears in your site\'s sidebars and other regions.', @@ -592,7 +592,7 @@ function block_theme_initialize($theme) { // Initialize theme's blocks if none already registered. $has_blocks = (bool) db_query_range('SELECT 1 FROM {block} WHERE theme = :theme', 0, 1, array(':theme' => $theme))->fetchField(); if (!$has_blocks) { - $default_theme = variable_get('theme_default', 'garland'); + $default_theme = variable_get('theme_default', 'bartik'); $regions = system_region_list($theme); $result = db_query("SELECT * FROM {block} WHERE theme = :theme", array(':theme' => $default_theme), array('fetch' => PDO::FETCH_ASSOC)); foreach ($result as $block) { diff --git a/modules/block/block.test b/modules/block/block.test index 9810db9f2..86584df7e 100644 --- a/modules/block/block.test +++ b/modules/block/block.test @@ -33,11 +33,11 @@ class BlockTestCase extends DrupalWebTestCase { // Define the existing regions $this->regions = array(); - $this->regions[] = array('name' => 'header', 'class' => 'region region-header clearfix'); - $this->regions[] = array('name' => 'sidebar_first'); - $this->regions[] = array('name' => 'content'); - $this->regions[] = array('name' => 'sidebar_second'); - $this->regions[] = array('name' => 'footer'); + $this->regions[] = 'header'; + $this->regions[] = 'sidebar_first'; + $this->regions[] = 'content'; + $this->regions[] = 'sidebar_second'; + $this->regions[] = 'footer'; } /** @@ -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]['name']; + $edit['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. @@ -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]['name']; + $edit[$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.')); @@ -237,18 +237,13 @@ class BlockTestCase extends DrupalWebTestCase { } function moveBlockToRegion($block, $region) { - // If an id for an region hasn't been specified, we assume it's the same as the name. - if (!(isset($region['class']))) { - $region['class'] = 'region region-' . str_replace('_', '-', $region['name']); - } - // Set the created block to a specific region. $edit = array(); - $edit[$block['module'] . '_' . $block['delta'] . '[region]'] = $region['name']; + $edit[$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. - $this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region['name']))); + $this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region))); // Confirm that the block is being displayed. $this->drupalGet('node'); @@ -256,10 +251,10 @@ class BlockTestCase extends DrupalWebTestCase { // Confirm that the custom block was found at the proper region. $xpath = $this->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', array( - ':region-class' => $region['class'], + ':region-class' => 'region region-' . str_replace('_', '-', $region), ':block-id' => 'block-' . $block['module'] . '-' . $block['delta'], )); - $this->assertFieldByXPath($xpath, FALSE, t('Custom block found in %region_name region.', array('%region_name' => $region['name']))); + $this->assertFieldByXPath($xpath, FALSE, t('Custom block found in %region_name region.', array('%region_name' => $region))); } /** @@ -327,12 +322,17 @@ class NewDefaultThemeBlocks extends DrupalWebTestCase { $this->drupalLogin($admin_user); // Ensure no other theme's blocks are in the block table yet. - $count = db_query_range("SELECT 1 FROM {block} WHERE theme NOT IN ('garland', 'seven')", 0, 1)->fetchField(); - $this->assertFalse($count, t('Only Garland and Seven have blocks.')); + $themes = array(); + $themes['default'] = variable_get('theme_default', 'bartik'); + if ($admin_theme = variable_get('admin_theme')) { + $themes['admin'] = $admin_theme; + } + $count = db_query_range('SELECT 1 FROM {block} WHERE theme NOT IN (:themes)', 0, 1, array(':themes' => $themes))->fetchField(); + $this->assertFalse($count, t('Only the default theme and the admin theme have blocks.')); // Populate list of all blocks for matching against new theme. $blocks = array(); - $result = db_query("SELECT * FROM {block} WHERE theme = 'garland'"); + $result = db_query('SELECT * FROM {block} WHERE theme = :theme', array(':theme' => $themes['default'])); foreach ($result as $block) { // $block->theme and $block->bid will not match, so remove them. unset($block->theme, $block->bid); @@ -340,10 +340,10 @@ class NewDefaultThemeBlocks extends DrupalWebTestCase { } // Turn on the Stark theme and ensure that it contains all of the blocks - // that Garland did. + // the default theme had. theme_enable(array('stark')); variable_set('theme_default', 'stark'); - $result = db_query("SELECT * FROM {block} WHERE theme='stark'"); + $result = db_query('SELECT * FROM {block} WHERE theme = :theme', array(':theme' => 'stark')); foreach ($result as $block) { unset($block->theme, $block->bid); $this->assertEqual($blocks[$block->module][$block->delta], $block, t('Block %name matched', array('%name' => $block->module . '-' . $block->delta))); |