function shortcut_set_delete

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.