theme_poll_choices

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 theme_poll_choices($form)

Theme the admin poll form for choices.

Verwandte Themen

Code

modules/poll/poll.module, line 721

<?php
function theme_poll_choices($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'] = 'poll-weight';

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

    // Add any additional classes set on the row.
    $row['class'] .= isset($form[$key]['#attributes']['class']) ? ' ' . $form[$key]['#attributes']['class'] : '';

    $rows[] = $row;
  }

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

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen