function shortcut_install in Drupal 7
Same name and namespace in other branches
- 8 core/modules/shortcut/shortcut.install \shortcut_install()
- 9 core/modules/shortcut/shortcut.install \shortcut_install()
- 10 core/modules/shortcut/shortcut.install \shortcut_install()
Implements hook_install().
File
- modules/
shortcut/ shortcut.install, line 11 - Install, update and uninstall functions for the shortcut module.
Code
function shortcut_install() {
$t = get_t();
// Create an initial default shortcut set.
$shortcut_set = new stdClass();
$shortcut_set->title = $t('Default');
$shortcut_set->links = array(
array(
'link_path' => 'node/add',
'link_title' => $t('Add content'),
'weight' => -20,
),
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.)
if (drupal_installation_attempted()) {
menu_rebuild();
}
shortcut_set_save($shortcut_set);
}