You are here

function imagepicker_admin_orphans_form in Image Picker 7

Same name and namespace in other branches
  1. 6.2 imagepicker.admin.inc \imagepicker_admin_orphans_form()
1 string reference to 'imagepicker_admin_orphans_form'
imagepicker_admin_orphans in ./imagepicker.admin.inc

File

./imagepicker.admin.inc, line 1214
@author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function imagepicker_admin_orphans_form($form_state) {

  // show a dropdown of nonexistent user ids
  // two choices:
  // reallocate to another user
  // delete the images
  $dir = imagepicker_get_files_directory();
  $orphanids = imagepicker_check_orphans($dir);
  if ($orphanids) {
    foreach ($orphanids as $v) {
      $opt[$v] = $v;
    }
    $form['orphanids'] = array(
      '#type' => 'select',
      '#options' => $opt,
      '#title' => t('Nonexistent user ids'),
      '#description' => t('These ids no longer exist but still have images. Choose what to do below'),
    );
    $form['reallocate_to_user'] = array(
      '#type' => 'textfield',
      '#title' => t('Reallocate to'),
      '#description' => t('Select a user who will own these images.'),
      '#autocomplete_path' => IMAGEPICKER_ADMIN_PATH . '/orphans/autocomplete',
      '#default_value' => '',
      '#maxlength' => 30,
      '#size' => 25,
    );
    $form['orphans_delete'] = array(
      '#type' => 'checkbox',
      '#title' => t('Delete the images'),
      '#return_value' => 1,
    );
    $form['msg'] = array(
      '#markup' => t("Any content using these images will be broken unless removed or edited."),
    );
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Go'),
    );
  }
  else {
    $form['orphans_message'] = array(
      '#markup' => t('No orphans found'),
    );
  }
  return $form;
}