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 drupal/modules/shortcut/shortcut.module
Implements hook_menu().

File

drupal/modules/shortcut/shortcut.admin.inc, line 769
Administrative page callbacks for the shortcut module.

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