You are here

function forum_form_forum in Drupal 4

Same name and namespace in other branches
  1. 5 modules/forum/forum.module \forum_form_forum()
  2. 6 modules/forum/forum.admin.inc \forum_form_forum()
  3. 7 modules/forum/forum.admin.inc \forum_form_forum()

Returns a form for adding a forum to the forum vocabulary

Parameters

$edit Associative array containing a forum term to be added or edited.:

1 string reference to 'forum_form_forum'
forum_menu in modules/forum.module
Implementation of hook_menu().

File

modules/forum.module, line 481
Enable threaded discussions about general topics.

Code

function forum_form_forum($edit = array()) {

  // Handle a delete operation.
  if ($_POST['op'] == t('Delete') || $_POST['edit']['confirm']) {
    return _forum_confirm_delete($edit['tid']);
  }
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Forum name'),
    '#default_value' => $edit['name'],
    '#maxlength' => 64,
    '#description' => t('The forum name is used to identify related discussions.'),
    '#required' => TRUE,
  );
  $form['description'] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#default_value' => $edit['description'],
    '#description' => t('The forum description can give users more information about the discussion topics it contains.'),
  );
  $form['parent']['#tree'] = TRUE;
  $form['parent'][0] = _forum_parent_select($edit['tid'], t('Parent'), 'forum');
  $form['weight'] = array(
    '#type' => 'weight',
    '#title' => t('Weight'),
    '#default_value' => $edit['weight'],
    '#description' => t('When listing forums, those with lighter (smaller) weights get listed before containers with heavier (larger) weights. Forums with equal weights are sorted alphabetically.'),
  );
  $form['vid'] = array(
    '#type' => 'hidden',
    '#value' => _forum_get_vid(),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  if ($edit['tid']) {
    $form['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
    );
    $form['tid'] = array(
      '#type' => 'hidden',
      '#value' => $edit['tid'],
    );
  }
  return drupal_get_form('forum_form_forum', $form, 'forum_form');
}