Resets the link weights in a shortcut set to match their current order.
This function can be used, for example, when a new shortcut link is added to the set. If the link is added to the end of the array and this function is called, it will force that link to display at the end of the list.
object $shortcut_set: An object representing a shortcut set. The link weights of the passed-in object will be reset as described above.
function shortcut_set_reset_link_weights(&$shortcut_set) {
$weight = -50;
foreach ($shortcut_set->links as &$link) {
$link['weight'] = $weight;
$weight++;
}
}