forum_form_forum

  1. drupal
    1. 4.7
    2. 5 forum.module
    3. 6 forum.admin.inc
    4. 7 forum.admin.inc
Versions
4.7 – 5 forum_form_forum($edit = array())
6 forum_form_forum(&$form_state, $edit = array())
7 forum_form_forum($form, &$form_state, $edit = array())

Returns a form for adding a forum to the forum vocabulary

Parameters

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

Code

modules/forum.module, line 482

<?php
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');
}
?>