function shortcut_link_add_inline

Menu page callback: creates a new link in the provided shortcut set.

After completion, redirects the user back to where they came from.

Parameters

$shortcut_set: Returned from shortcut_set_load().

1 string reference to 'shortcut_link_add_inline'
shortcut_menu in modules/shortcut/shortcut.module
Implements hook_menu().

File

modules/shortcut/shortcut.admin.inc, line 769

Code

function shortcut_link_add_inline($shortcut_set) {
    if (isset($_REQUEST['token']) && drupal_valid_token($_REQUEST['token'], 'shortcut-add-link') && shortcut_valid_link($_GET['link'])) {
        $item = menu_get_item($_GET['link']);
        $title = $item && $item['title'] ? $item['title'] : $_GET['name'];
        $link = array(
            'link_title' => $title,
            'link_path' => $_GET['link'],
        );
        shortcut_admin_add_link($link, $shortcut_set, shortcut_max_slots());
        if (shortcut_set_save($shortcut_set)) {
            drupal_set_message(t('Added a shortcut for %title.', array(
                '%title' => $link['link_title'],
            )));
        }
        else {
            drupal_set_message(t('Unable to add a shortcut for %title.', array(
                '%title' => $link['link_title'],
            )));
        }
        drupal_goto();
    }
    return MENU_ACCESS_DENIED;
}

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