upload.module by default does not display its upload_attachments table in teasers (its output depends on the condition !$teaser).

upload_image calls upload_attachments as follows (starting line 96):

// Add the attachments list
        if (count($node->no_images)) {
          $node->content['files'] = array(
            '#value' => theme('upload_attachments', $node->no_images),
            '#weight' => 50,
            );
        }

causing attachments that are not images to be displayed even in teaser view. This can be solved by changing the above code to:

// Add the attachments list
        if (count($node->no_images) && !$teaser) {
          $node->content['files'] = array(
            '#value' => theme('upload_attachments', $node->no_images),
            '#weight' => 50,
            );
        }

I'm still new to this and have not yet looked into how to create a patch. I hope this is helpful "as is".

Comments

sebxian’s picture

Also, I'm not sure I understand the whole structure of the code. Maybe it would be good to handle the upload_attachments in theme_upload_images(), theme_upload_images_body(), and theme_upload_images_teaser() ?

Or in another way that makes it easier to override upload_image standard settings in template.php, as I did with theme_upload_images_teaser() to remove the thumbnails from my teasers.

killes@www.drop.org’s picture

Status: Active » Closed (duplicate)