You are here

function forum_form_container in Drupal 4

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

Returns a form for adding a container to the forum vocabulary

Parameters

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

2 string references to 'forum_form_container'
forum_form_submit in modules/forum.module
Process forum form and container form submissions.
forum_menu in modules/forum.module
Implementation of hook_menu().

File

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

Code

function forum_form_container($edit = array()) {

  // Handle a delete operation.
  if ($_POST['op'] == t('Delete') || $_POST['edit']['confirm']) {
    return _forum_confirm_delete($edit['tid']);
  }
  $form['name'] = array(
    '#title' => t('Container name'),
    '#type' => 'textfield',
    '#default_value' => $edit['name'],
    '#maxlength' => 64,
    '#description' => t('The container name is used to identify related forums.'),
    '#required' => TRUE,
  );
  $form['description'] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#default_value' => $edit['description'],
    '#description' => t('The container description can give users more information about the forums it contains.'),
  );
  $form['parent']['#tree'] = TRUE;
  $form['parent'][0] = _forum_parent_select($edit['tid'], t('Parent'), 'container');
  $form['weight'] = array(
    '#type' => 'weight',
    '#title' => t('Weight'),
    '#default_value' => $edit['weight'],
    '#description' => t('When listing containers, those with with light (small) weights get listed before containers with heavier (larger) weights. Containers 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' => 'value',
      '#value' => $edit['tid'],
    );
  }
  return drupal_get_form('forum_form_container', $form, 'forum_form');
}