Commit a1bdd974 authored by webchick's avatar webchick

Issue #1177830 by sun, tstoeckler, Tor Arne Thune: Shortcut_install() should...

Issue #1177830 by sun, tstoeckler, Tor Arne Thune: Shortcut_install() should be in standard_install().
parent 8be648df
......@@ -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.
......
......@@ -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);
}
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment