You are here

function nodeorder_link in Node Order 6

Same name and namespace in other branches
  1. 5 nodeorder.module \nodeorder_link()

Implementation of hook_link().

File

./nodeorder.module, line 129
Nodeorder module.

Code

function nodeorder_link($type, $node = 0, $main = 0) {
  $links = array();
  if (user_access('order nodes within categories') && variable_get('nodeorder_show_links_on_node', 1) > 0) {

    // If this node belongs to any vocabularies that are orderable,
    // stick a couple links on per term to allow the user to move
    // the node up or down within the term...
    if ($type == 'node') {
      if (array_key_exists('taxonomy', $node)) {
        $vocabularies = taxonomy_get_vocabularies();
        if (variable_get('nodeorder_show_links_on_node', 1) == 2 && ((arg(0) == 'taxonomy' || arg(0) == 'nodeorder') && arg(1) == 'term')) {
          $term = taxonomy_get_term(arg(2));
          nodeorder_add_link($links, $vocabularies, $node, $term);
        }
        else {
          if (variable_get('nodeorder_show_links_on_node', 1) == 1) {
            foreach ($node->taxonomy as $term) {
              nodeorder_add_link($links, $vocabularies, $node, $term);
            }
          }
        }
      }
    }
  }
  return $links;
}