shortcut_set_delete

function shortcut_set_delete

shortcut_set_delete($shortcut_set)

Deletes a shortcut set.

Note that the default set cannot be deleted.

Parameters

$shortcut_set: An object representing the shortcut set to delete.

Return value

TRUE if the set was deleted, FALSE otherwise.

File

modules/shortcut/shortcut.module, line 391
Allows users to manage customizable lists of shortcut links.

Code

function shortcut_set_delete($shortcut_set) {
  // Don't allow deletion of the system default shortcut set.
  if ($shortcut_set->set_name == SHORTCUT_DEFAULT_SET_NAME) {
    return FALSE;
  }

  // First, delete any user assignments for this set, so that each of these
  // users will go back to using whatever default set applies.
  db_delete('shortcut_set_users')
    ->condition('set_name', $shortcut_set->set_name)
    ->execute();

  // Next, delete the menu links for this set.
  menu_delete_links($shortcut_set->set_name);

  // Finally, delete the set itself.
  $deleted = db_delete('shortcut_set')
    ->condition('set_name', $shortcut_set->set_name)
    ->execute();

  return (bool) $deleted;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!shortcut!shortcut.module/function/shortcut_set_delete/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部