You are here

function node_gallery_sort_images_form_remove_weights_submit in Node Gallery 6.3

Submit function to reset all image weights in a gallery to 0, effectively removing any custom sort.

1 string reference to 'node_gallery_sort_images_form_remove_weights_submit'
node_gallery_sort_images_form in ./node_gallery.pages.inc
Form function for the "Sort Images" tab.

File

./node_gallery.pages.inc, line 849
Handles displaying of Node gallery pages.

Code

function node_gallery_sort_images_form_remove_weights_submit($form, &$form_state) {
  $result = db_query('UPDATE {node_gallery_images} SET weight = 0 WHERE gid = %d', $form_state['values']['gid']);
  if ($result === FALSE) {
    $message = t("There was a problem updating your images.");
  }
  else {
    $message = t("All image weights have been reset. The global sorting is now active again.");
  }
  node_gallery_clear_gallery_caches($form_state['values']['gid']);
  drupal_set_message($message);
}