function shortcut_set_reset_link_weights

shortcut_set_reset_link_weights(&$shortcut_set)

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.

File

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

Code

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!shortcut!shortcut.module/function/shortcut_set_reset_link_weights/7.x