You are here

function node_gallery_set_image_weight in Node Gallery 6.3

Sets the weight on an image node.

When the Action API is used to set the weight on an image node, it does not set the weight on the node directly, it sets it on the new_weight attribute. This allows us to determine if the weight actually changed or not, and clear the caches only in cases where the weight has changed.

Parameters

$image: A reference to a populated image node object.

1 call to node_gallery_set_image_weight()
node_gallery_nodeapi in ./node_gallery.module
Implements hook_nodeapi().

File

./node_gallery.inc, line 786
Shared functions for node_gallery

Code

function node_gallery_set_image_weight(&$image) {
  $sort_order_changed = FALSE;
  if (isset($image->new_weight)) {
    if (!isset($image->weight) || $image->new_weight != $image->weight) {
      $image->weight = $image->new_weight;
      node_gallery_clear_gallery_caches($image->gid);
    }
  }
}