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 drupal/modules/shortcut/shortcut.module
Saves a shortcut set.

File

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

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