You are here

function _weight_set_weight_from_menu_link in Weight 7.2

Set the weight of a node from the menu link.

2 calls to _weight_set_weight_from_menu_link()
weight_menu_link_insert in ./weight.module
Implements hook_menu_link_insert().
weight_menu_link_update in ./weight.module
Implements hook_menu_link_update().

File

./weight.module, line 711

Code

function _weight_set_weight_from_menu_link($link) {

  // Block updating by users without appropriate permissions
  if (user_access('assign node weight')) {
    $node = _weight_get_node_from_menu_link($link);
    $weight_types = _weight_get_types();
    if (is_object($node) && in_array($node->type, $weight_types)) {
      $settings = _weight_get_settings($node->type);

      // Only use menu weight if that setting has been checked
      if ($settings['menu_weight']) {
        _weight_set_weight($node);
      }
    }
  }
}