You are here

function imagepicker_postlet_form_alter in Image Picker 6.2

Implementation of hook_form_alter(). Adds imagepicker_postlet settings to the imagepicker settings form.

File

contribs/imagepicker_postlet/imagepicker_postlet.module, line 381
Enables upload of images using Postlet java applet. http://www.postlet.com/ http://sourceforge.net/projects/postlet/

Code

function imagepicker_postlet_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'imagepicker_settings_form') {
    drupal_add_js(drupal_get_path('module', 'imagepicker_postlet') . '/imagepicker_postlet.js');
    $form['imagepicker_postlet'] = array(
      '#type' => 'fieldset',
      '#title' => t('Imagepicker Multi Upload'),
      '#description' => t("Configure Multiple upload of images using 'postlet' java applet."),
      '#collapsible' => TRUE,
      '#collapsed' => variable_get('imagepicker_postlet_enabled', 0) ? TRUE : FALSE,
      '#weight' => -12,
    );
    $form['imagepicker_postlet']['imagepicker_postlet_width'] = array(
      '#type' => 'textfield',
      '#title' => t('Postlet width'),
      '#description' => t('Configure the postlet width. This can be a number or a percentage, eg 400 or 100%'),
      '#size' => 10,
      '#required' => TRUE,
      '#default_value' => variable_get('imagepicker_postlet_width', "600"),
    );
    $form['imagepicker_postlet']['imagepicker_postlet_height'] = array(
      '#type' => 'textfield',
      '#title' => t('Postlet height'),
      '#description' => t('Configure the postlet height. This must be a number, eg 200'),
      '#size' => 10,
      '#required' => TRUE,
      '#default_value' => variable_get('imagepicker_postlet_height', "175"),
    );
    $form['imagepicker_postlet']['imagepicker_postlet_byrole'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable Imagepicker Multi Upload by Role'),
      '#description' => t("Setting this option will enable 'Multi Upload by Role' instead of 'Per User'."),
      '#return_value' => 1,
      '#default_value' => variable_get('imagepicker_postlet_byrole', 0),
    );
    $form['imagepicker_postlet']['imagepicker_postlet_role'] = array(
      '#type' => 'radios',
      '#title' => t('Available Roles'),
      '#description' => t("Select which Role for 'Multi Upload by Role'."),
      '#options' => user_roles(TRUE),
      '#default_value' => variable_get('imagepicker_postlet_role', 2),
      '#prefix' => '<div id="wrap_imagepicker_postlet_role">',
      '#suffix' => '</div>',
    );
  }
}