You are here

function nodeorder_node_view in Node Order 7

Implements hook_node_view().

File

./nodeorder.module, line 243
Nodeorder module.

Code

function nodeorder_node_view($node, $view_mode, $langcode) {
  $show_links = variable_get('nodeorder_show_links_on_node', 1);
  if (user_access('order nodes within categories') && $show_links) {

    // 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.
    $results = db_select('taxonomy_index', 'ti')
      ->fields('ti', array(
      'tid',
    ))
      ->condition('nid', $node->nid)
      ->execute();
    $terms = taxonomy_term_load_multiple($results
      ->fetchCol());
    foreach ($terms as $term) {
      if (nodeorder_vocabulary_can_be_ordered($term->vid)) {
        nodeorder_add_links($node, $term);
      }
    }
  }
}