theme_poll_choices

Versions
mediamosa-21
theme_poll_choices($variables)

Theme the admin poll form for choices.

Related topics

Code

modules/poll/poll.module, line 787

<?php
function theme_poll_choices($variables) {
  $form = $variables['form'];

  drupal_add_tabledrag('poll-choice-table', 'order', 'sibling', 'poll-weight');

  $delta = 0;
  $rows = array();
  $headers = array(
    '',
    t('Choice'),
    t('Vote count'),
    t('Weight'),
  );

  foreach (element_children($form) as $key) {
    $delta++;
    // Set special classes for drag and drop updating.
    $form[$key]['weight']['#attributes']['class'] = array('poll-weight');

    // Build the table row.
    $row = array(
      'data' => array(
        array('class' => array('choice-flag')),
        drupal_render($form[$key]['chtext']),
        drupal_render($form[$key]['chvotes']),
        drupal_render($form[$key]['weight']),
      ),
      'class' => array('draggable'),
    );

    // Add any additional classes set on the row.
    if (!empty($form[$key]['#attributes']['class'])) {
      $row['class'] = array_merge($row['class'], $form[$key]['#attributes']['class']);
    }

    $rows[] = $row;
  }

  $output = theme('table', array('header' => $headers, 'rows' => $rows, 'attributes' => array('id' => 'poll-choice-table')));
  $output .= drupal_render_children($form);
  return $output;
}
?>