How can I build a block to show the last image stored in galleries?

CommentFileSizeAuthor
#5 fix-recently-added-1112466-5.patch606 bytesMoloc
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David_Rothstein’s picture

Title: Block to shwo last image » Media gallery blocks no longer sort by most recent
Category: support » bug

Looks to me like this might be a bug.

In theory the module does this for you, if you choose the "create a block of most recently added media" option when editing the gallery. Then if you set the block to 1 row x 1 column, the block will only show one item - which should be the most recent one.

However, I just tried that now and it doesn't seem to actually be showing the most recent item anymore.

rkp103’s picture

Is there any fix on this?

effulgentsia’s picture

Version: 7.x-1.0-beta4 » 7.x-1.x-dev

No fix yet. The culprit is this code in media_gallery_view():

$full = $view_mode == 'full' ? TRUE : FALSE;
    if (!empty($node->media_gallery_media)) {
      $media = $full ? $node->media_gallery_media[LANGUAGE_NONE] : $node->media_gallery_media_original[LANGUAGE_NONE];  
    }

which undoes the ordering performed in media_gallery_block_view().

mmeytin’s picture

Any updates on this issue? Doesn't seem to work in the most recent dev version of the Media Gallery. Thanks!

Moloc’s picture

Status: Active » Needs review
FileSize
606 bytes

media_gallery_block_view() creates an ordering in the property media_gallery_media and not media_gallery_media_original.
There is no need to distinguish between view-mode full and media_gallery_block in this part of code.

Here is a patch.

helmo’s picture

Status: Needs review » Reviewed & tested by the community

Great, that fixes the problem.

lsolesen’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.