function shortcut_install

Same name in other branches
  1. 9 core/modules/shortcut/shortcut.install \shortcut_install()
  2. 8.9.x core/modules/shortcut/shortcut.install \shortcut_install()
  3. 10 core/modules/shortcut/shortcut.install \shortcut_install()
  4. 11.x core/modules/shortcut/shortcut.install \shortcut_install()

Implements hook_install().

File

modules/shortcut/shortcut.install, line 11

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.