You are here

function user_badges_images_form in User Badges 6

Same name and namespace in other branches
  1. 5 user_badges.module \user_badges_images_form()
  2. 6.2 user_badges.admin.inc \user_badges_images_form()
  3. 7 user_badges.admin.inc \user_badges_images_form()
  4. 7.2 user_badges.admin.inc \user_badges_images_form()
  5. 7.3 user_badges.admin.inc \user_badges_images_form()

form to upload the badge images or to delete existing ones

1 string reference to 'user_badges_images_form'
user_badges_menu in ./user_badges.module
Implements hook_menu().

File

./user_badges.admin.inc, line 351
@brief User Badges admin functions

Code

function user_badges_images_form($form_state) {
  $form = array(
    '#skip_duplicate_check' => TRUE,
  );
  if (module_exists('upload')) {
    $form['new']['upload'] = array(
      '#type' => 'file',
      '#title' => t('Upload image'),
      '#size' => 40,
    );
    $form['new']['attach'] = array(
      '#type' => 'submit',
      '#value' => t('Upload'),
    );
  }
  else {
    drupal_set_message(t('Upload of images requires the upload module to be enabled.'), 'error');
  }
  $form['#attributes']['enctype'] = 'multipart/form-data';
  $selects = user_badges_image_selects();
  if (count($selects)) {
    $form['images'] = array(
      '#tree' => TRUE,
    );
    foreach ($selects as $imagepath => $imageimg) {
      $form['images'][$imagepath] = array(
        '#type' => 'checkbox',
        '#title' => $imageimg,
        '#return_value' => 1,
        '#default_value' => FALSE,
        '#description' => check_plain($imagepath),
      );
    }
    $form['delete_image'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
    );
  }
  return $form;
}