Modify node in hook_node_view() for Drupal 7 I'm trying to modify the array of content, and add an extra link.


I don't want to use the Link module; this link is going to be generated with other fields, it's something like Computed Field module (which is in developing stage for Drupal 7, and I'd rather not use it).
I don't want to just add HTML/PHP to node.tpl.php. I want this to be nice solution.


I've been trying with adding new field to $node-&gt;content. I managed to copy another field and display it once again. I was able to change label of that field, but not the link itself. 

Does anyone have any idea on how to proceed?
You can do this by implementing hook_node_view. 

For example:

function my_module_node_view($node, $view_mode, $langcode) {
  switch ($node-&gt;type) {
    case 'my_node_type':
      $node-&gt;content['extra_link'] = array(
          '#weight' =&gt; 10,
          '#theme' =&gt; 'link',
          '#path' =&gt; 'path_to_content',
          '#text' =&gt; t('An extra link'),
          '#options' =&gt; array(
              'attributes' =&gt; array(),
              'html' =&gt; FALSE
          ),
      );
      break;
  }
}