function shortcut_set_delete in Drupal 7
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.
1 call to shortcut_set_delete()
- shortcut_set_delete_form_submit in modules/
shortcut/ shortcut.admin.inc - Submit handler for shortcut_set_delete_form().
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;
}