From a1bdd9747420a36defcce03ee0597feea61fa545 Mon Sep 17 00:00:00 2001 From: webchick Date: Tue, 4 Sep 2012 20:13:17 -0700 Subject: [PATCH] Issue #1177830 by sun, tstoeckler, Tor Arne Thune: Shortcut_install() should be in standard_install(). --- .../shortcut/Tests/ShortcutTestBase.php | 16 ++++++++++++- core/modules/shortcut/shortcut.install | 24 ------------------- core/profiles/standard/standard.install | 14 +++++++++++ 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutTestBase.php b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutTestBase.php index 993897ba352..8c94435b8c2 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutTestBase.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutTestBase.php @@ -45,10 +45,24 @@ abstract class ShortcutTestBase extends WebTestBase { function setUp() { parent::setUp(); - // Create Basic page and Article node types. if ($this->profile != 'standard') { + // Create Basic page and Article node types. $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); + + // Populate the default shortcut set. + $shortcut_set = shortcut_set_load(SHORTCUT_DEFAULT_SET_NAME); + $shortcut_set->links[] = array( + 'link_path' => 'node/add', + 'link_title' => st('Add content'), + 'weight' => -20, + ); + $shortcut_set->links[] = array( + 'link_path' => 'admin/content', + 'link_title' => st('Find content'), + 'weight' => -19, + ); + shortcut_set_save($shortcut_set); } // Create users. diff --git a/core/modules/shortcut/shortcut.install b/core/modules/shortcut/shortcut.install index 9ee9fd36505..c4023d7aadc 100644 --- a/core/modules/shortcut/shortcut.install +++ b/core/modules/shortcut/shortcut.install @@ -14,30 +14,6 @@ function shortcut_install() { $shortcut_set = new stdClass(); $shortcut_set->title = $t('Default'); $shortcut_set->links = array(); - if (module_exists('node')) { - $shortcut_set->links[] = array( - 'link_path' => 'node/add', - 'link_title' => $t('Add content'), - 'weight' => -20, - ); - $shortcut_set->links[] = array( - 'link_path' => 'admin/content', - 'link_title' => $t('Find content'), - 'weight' => -19, - ); - } - // If Drupal is being installed, rebuild the menu before saving the shortcut - // set, to make sure the links defined above can be correctly saved. (During - // installation, the menu might not have been built at all yet, or it might - // have been built but without the node module's links in it.) - // drupal_installation_attempted() cannot be used here, as it relies on the - // MAINTENANCE_MODE constant value, which cannot be set when running tests, so - // we check the 'install_task' variable instead, which is only "done" when - // Drupal is already installed (i.e., we are not in the installer). - // @see http://drupal.org/node/1376150 - if (variable_get('install_task', '') != 'done') { - menu_router_rebuild(); - } shortcut_set_save($shortcut_set); } diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index 32221b36aad..f3eaf2924a7 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -401,6 +401,20 @@ function standard_install() { ); menu_link_save($item); + // Populate the default shortcut set. + $shortcut_set = shortcut_set_load(SHORTCUT_DEFAULT_SET_NAME); + $shortcut_set->links[] = array( + 'link_path' => 'node/add', + 'link_title' => st('Add content'), + 'weight' => -20, + ); + $shortcut_set->links[] = array( + 'link_path' => 'admin/content', + 'link_title' => st('Find content'), + 'weight' => -19, + ); + shortcut_set_save($shortcut_set); + // Update the menu router information. menu_router_rebuild();