You are here

function user_badges_images_form in User Badges 7.3

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. 6 user_badges.admin.inc \user_badges_images_form()
  4. 7 user_badges.admin.inc \user_badges_images_form()
  5. 7.2 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 577
@brief User Badges admin functions

Code

function user_badges_images_form($form, $form_state) {
  $selects = _user_badges_images_from_library();
  if (count($selects)) {
    $form['images'] = array(
      '#tree' => TRUE,
    );
    foreach ($selects as $filepath => $image) {
      $form['images'][$filepath] = array(
        '#type' => 'checkbox',
        '#title' => $image->image,
        '#return_value' => 1,
        '#default_value' => FALSE,
        '#description' => check_plain($image->file->uri),
      );
    }
    $form['delete_image'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
    );
  }
  else {
    $form['empty'] = array(
      '#type' => 'item',
      '#description' => t('There are no images in your library at the moment. You can add one !create_link and uploading an image.', array(
        '!create_link' => l(t('by creating a badge'), 'admin/config/people/user_badges/add'),
      )),
    );
  }
  return $form;
}