You are here

function node_gallery_change_image_weight_action in Node Gallery 6.3

Sets an image's weight.

Parameters

object $node: A populated node object.

$context: (optional) An associative array supplied by the Actions API.

File

./node_gallery.actions.inc, line 65
Contains all actions for node gallery.

Code

function node_gallery_change_image_weight_action(&$node, $context = array()) {
  if (in_array($node->type, (array) node_gallery_get_types('image'))) {

    // All nodes are being set to the same weight
    if (is_numeric($context['imageweight'])) {
      $node->new_weight = $context['imageweight'];
    }
    else {
      $node->new_weight = $context['imageweight'][$node->nid];
    }
  }
}