function nodeorder_add_link in Node Order 6
1 call to nodeorder_add_link()
- nodeorder_link in ./
nodeorder.module - Implementation of hook_link().
File
- ./
nodeorder.module, line 157 - Nodeorder module.
Code
function nodeorder_add_link(&$links, $vocabularies, $node, $term) {
$vocabulary = $vocabularies[$term->vid];
if ($vocabulary->module == 'nodeorder') {
$weights = nodeorder_get_term_min_max($term->tid, FALSE);
$weight = db_result(db_query("SELECT weight_in_tid FROM {term_node} WHERE nid = %d AND tid = %d", $node->nid, $term->tid));
if ($weight > $weights["min"]) {
$links['nodeorder_move_up_' . $term->tid] = array(
'href' => "nodeorder/moveup/" . $node->nid . "/" . $term->tid,
'title' => t("move up in " . $term->name),
'query' => drupal_get_destination(),
'attributes' => array(
'title' => t("Move this " . $node->type . " up in its category."),
),
);
}
if ($weight < $weights["max"]) {
$links['nodeorder_move_down_' . $term->tid] = array(
'href' => "nodeorder/movedown/" . $node->nid . "/" . $term->tid,
'title' => t("move down in " . $term->name),
'query' => drupal_get_destination(),
'attributes' => array(
'title' => t("Move this " . $node->type . " down in its category."),
),
);
}
}
}