function shortcut_set_reset_link_weights

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.

Parameters

object $shortcut_set: An object representing a shortcut set. The link weights of the passed-in object will be reset as described above.

1 call to shortcut_set_reset_link_weights()
shortcut_admin_add_link in modules/shortcut/shortcut.admin.inc
Adds a link to the end of a shortcut set, keeping within a prescribed limit.

File

modules/shortcut/shortcut.module, line 425

Code

function shortcut_set_reset_link_weights(&$shortcut_set) {
    $weight = -50;
    foreach ($shortcut_set->links as &$link) {
        $link['weight'] = $weight;
        $weight++;
    }
}

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