You are here

function media_gallery_multiedit_remove_item in Media Gallery 7.2

Same name and namespace in other branches
  1. 7 media_gallery.module \media_gallery_multiedit_remove_item()

Form submit handler to remove a media item from a gallery.

1 string reference to 'media_gallery_multiedit_remove_item'
_media_gallery_add_remove_checkbox in ./media_gallery.module
Add a "remove" checkbox to the media edit form.

File

./media_gallery.module, line 1118

Code

function media_gallery_multiedit_remove_item($form, &$form_state) {
  if (isset($form['#gallery'])) {
    $gallery = $form['#gallery'];
    if (!empty($form_state['values']['remove'])) {

      // Remove the item from the gallery.
      $file = file_load($form_state['values']['fid']);
      media_gallery_remove_item_from_gallery($gallery, $file);
    }

    // Redirect to the gallery page.
    $uri = entity_uri('node', $gallery);
    $form_state['redirect'] = $uri;
  }
}