node_example_link

Versions
4.6
node_example_link($type, $node = 0, $main)

Implementation of hook_link().

This is implemented so that an edit link is displayed for users who have the rights to edit a node.

Code

developer/examples/node_example.module, line 93

<?php
function node_example_link($type, $node = 0, $main) {
  $links = array();

  if ($type == 'node' && $node->type == 'node_example') {
    // Don't display a redundant edit link if they are node administrators.
    if (node_example_access('update', $node) && !user_access('administer nodes')) {
      $links[] = l(t('edit this example node'), "node/$node->nid/edit");
    }
  }

  return $links;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.