You are here

function comment_upload_form_alter in Comment Upload 5

Same name and namespace in other branches
  1. 6 comment_upload.module \comment_upload_form_alter()

Hook into node type and upload settings forms.

File

./comment_upload.module, line 112

Code

function comment_upload_form_alter($form_id, &$form) {
  if ($form_id == 'node_type_form') {
    $form['workflow']['comment_upload'] = array(
      '#type' => 'radios',
      '#title' => t('Attachments on comments'),
      '#default_value' => variable_get('comment_upload_' . $form['#node_type']->type, 1),
      '#options' => array(
        t('Disabled'),
        t('Enabled'),
      ),
      '#weight' => 20,
    );
  }
  else {
    if ($form_id == 'upload_admin_settings') {
      $form['settings_general']['comment_upload_single'] = array(
        '#type' => 'select',
        '#title' => t('Attachments on comments'),
        '#default_value' => variable_get('comment_upload_single', 0),
        '#options' => array(
          t('Multiple'),
          t('Single'),
        ),
        '#description' => t('Set whether to allow only one attachment per comment'),
      );
      $form['settings_general']['comment_upload_inline_image'] = array(
        '#type' => 'select',
        '#title' => t('Images on comments'),
        '#default_value' => variable_get('comment_upload_inline_image', 0),
        '#options' => array(
          t('Normal attachment'),
          t('Inline display'),
        ),
        '#description' => t('Show uploaded image with comment or use a normal attachment link (single attachment mode only)'),
      );
    }
  }
}