function shortcut_set_get_unique_name

Returns a unique, machine-readable shortcut set name.

1 call to shortcut_set_get_unique_name()
shortcut_set_save in modules/shortcut/shortcut.module
Saves a shortcut set.

File

modules/shortcut/shortcut.module, line 545

Code

function shortcut_set_get_unique_name() {
    // Shortcut sets are numbered sequentially, so we keep trying until we find
    // one that is available. For better performance, we start with a number
    // equal to one more than the current number of shortcut sets, so that if
    // no shortcut sets have been deleted from the database, this will
    // automatically give us the correct one.
    $number = db_query("SELECT COUNT(*) FROM {shortcut_set}")->fetchField() + 1;
    do {
        $name = shortcut_set_name($number);
        $number++;
    } while ($shortcut_set = shortcut_set_load($name));
    return $name;
}

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