Deletes a shortcut set.
Note that the default set cannot be deleted.
$shortcut_set: An object representing the shortcut set to delete.
TRUE if the set was deleted, FALSE otherwise.
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;
}