Hi.
I'm working on a drupal module, and one thing that it needs to do is modify the display of cck file fields automatically (using template files is not an option). For example, this array:
$node->field_images[0]['view'];
That is what I would like to get into. The 'view' part will output an image based on the display settings for the content type. I would like to attach a link to each image before the node is displayed to the user.
One thing I've tried:
function mymodule_nodeapi(&$node, $op, $teaser, $page) {
      switch ($op) {
          case 'view':
            $node->content['field_images']['view'] = array(
              '#value' => "hello",
              '#weight' => 10
            );
          break;
      }
 }
This inserts the text one time after the last image. I tried using a foreach to loop through all of them and produced no results at all.
I've also tried this:
function mymodule_nodeapi(&$node, $op, $teaser, $page) {
      switch ($op) {
          case 'view':
              // Attach link           
              foreach($node->field_images as $media) {
                  $media['view'] .= generate_link($node->nid, $media);
              }           
          break;
      }
    }
It seems like it should work, but it doesn't. I've searched everywhere for solutions without any luck.
If someone could help me out I would really appreciate it.
Thanks a lot.