You are here

function _weight_decode in Weight 6

Same name and namespace in other branches
  1. 7 weight.module \_weight_decode()

Convert our weight back out of sticky.

2 calls to _weight_decode()
weight_form_node_admin_content_alter in ./weight.module
Implementation of hook_form_FORM_ID_alter().
weight_nodeapi in ./weight.module

File

./weight.module, line 486
This module uses the sticky column of the node table to add weighting to nodes.

Code

function _weight_decode(&$node) {
  if ($node->sticky == 0 || $node->sticky == 1) {
    $node->node_weight = 0;
    return;
  }
  if ($node->sticky > 0) {
    $node->node_weight = 100 - $node->sticky;
    $node->sticky = 1;
  }
  else {
    $node->node_weight = -($node->sticky + 100);
    $node->sticky = 0;
  }
}