Same name and namespace in other branches
  1. 4.7.x modules/comment.module \comment_controls()
  2. 5.x modules/comment/comment.module \comment_controls()

Build a comment control form.

Parameters

$mode: Comment display mode.

$order: Comment order mode.

$comments_per_page: Comments per page.

Related topics

1 string reference to 'comment_controls'
comment_node_type in modules/comment/comment.module
Implementation of hook_node_type().

File

modules/comment/comment.module, line 1610
Enables users to comment on published content.

Code

function comment_controls(&$form_state, $mode = COMMENT_MODE_THREADED_EXPANDED, $order = COMMENT_ORDER_NEWEST_FIRST, $comments_per_page = 50) {
  $form['mode'] = array(
    '#type' => 'select',
    '#default_value' => $mode,
    '#options' => _comment_get_modes(),
    '#weight' => 1,
  );
  $form['order'] = array(
    '#type' => 'select',
    '#default_value' => $order,
    '#options' => _comment_get_orders(),
    '#weight' => 2,
  );
  foreach (_comment_per_page() as $i) {
    $options[$i] = t('!a comments per page', array(
      '!a' => $i,
    ));
  }
  $form['comments_per_page'] = array(
    '#type' => 'select',
    '#default_value' => $comments_per_page,
    '#options' => $options,
    '#weight' => 3,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save settings'),
    '#weight' => 20,
  );
  return $form;
}