shortcut_link_add_inline

Versions
7
shortcut_link_add_inline($shortcut_set)

Menu 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().

Code

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

<?php
function shortcut_link_add_inline($shortcut_set) {
  if (isset($_REQUEST['token']) && drupal_valid_token($_REQUEST['token'], 'shortcut-add-link') && shortcut_valid_link($_GET['link'])) {
    $link = array(
      'link_title' => $_GET['name'],
      '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 drupal_access_denied();
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.