The original case was under http://drupal.org/node/668828. I would like to expand upon this solution and start a new thread. My goal is to take the existing 2.0-beta2 and upgrade the Admin API to include a setting for the order in which a new image is added (by default). Either by the old max weight + 1, or the old min weight -1. *I could also help to update the existing 3.0 branch, but our current website has 2.0. in place.

If possible, please give me feedback as to how to implement (for 2.0 and even 3.0). I propose the following edits:

/node_gallery.inc - function node_gallery_get_gallery_images - line 131
++ load node_gallery admin setting / variable and do an "if" according to the state
/node_gallery.inc - function node_gallery_image_save - line 256
++ add an if statement. If the new image should be at the top of the queue according to the Admin setting, then query the database first and set the $image_node weight before sending it to the insert record function.
node_gallery.admin.inc
functions node_gallery_settings_form --> add a configuration variable.

Thanks, Jeremy

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

justintime’s picture

Status: Active » Closed (won't fix)

Jeremy - this feature is already working in 3.x. There is a view display supplied with the module named 'default sort'. By configuring the sort order of that view, you are configuring the sort order of the images in the current relationship. Anything you can do with views to make a sort order (create date desc, create date asc, revision date asc, heck even alphabetically by author name if you so desired), you can do with the display order of your images.

No new features will be implemented in 2.x. You're more than welcome to write a patch, but the maintainers have so much on their plate right now that 3.x dev has stalled for a bit, it's unlikely any more commits will be made on the 2.x branch.

jjchinquist’s picture

Hi,

Uploading the patch anyhow so that it is available for others on the 2.x branch. Required 3 file/function updates.

I wanted to comment that the node_gallery module works very well for our needs and is a large improvement for user photo uploads over anything else we have implemented.

A point of improvement (if it applies for v-3.x, is that the variable names you defined in the administration section do not start with "node_gallery_...". It could lead to conflicts if other modules use the same variable names.

Cheers, Jeremy

justintime’s picture

Thanks for your contribution, it's appreciated. NG3 does properly namespace all variables and functions, so we're okay there too.