You are here

function _weight_update_7202_decode in Weight 7.2

Decode weight from sticky column.

1 call to _weight_update_7202_decode()
weight_update_7202 in ./weight.install
Move existing node weights to weight_weights table and restore sticky values.

File

./weight.install, line 515

Code

function _weight_update_7202_decode($sticky) {
  $values = array();
  if ($sticky == 0 || $sticky == 1) {
    $values['weight'] = NULL;
    $values['sticky'] = $sticky;
  }
  elseif ($sticky > 0) {
    $values['weight'] = 100 - $sticky;
    $values['sticky'] = 1;
  }
  else {
    $values['weight'] = -($sticky + 100);
    $values['sticky'] = 0;
  }
  return $values;
}