In the theming department this module seems to be missing the key ability to theme the actual polling forms. We can theme the bar, the results, etc., but where is the template file for the actual polls themselves? Something akin to poll-vote.tpl.php that is included in the core Poll module.

I realize that advpoll has a couple of different types of forms (choice, ranking, drag-and-drop ranking), but shouldn't we provide template files for all of them?

For reference, here's poll-vote.tpl.php from the core Poll module:

<?php
/**
 * @file
 * Default theme implementation to display voting form for a poll.
 *
 * - $choice: The radio buttons for the choices in the poll.
 * - $title: The title of the poll.
 * - $block: True if this is being displayed as a block.
 * - $vote: The vote button
 * - $rest: Anything else in the form that may have been added via
 *   form_alter hooks.
 *
 * @see template_preprocess_poll_vote()
 *
 * @ingroup themeable
 */
?>
<div class="poll">
  <div class="vote-form">
    <div class="choices">
      <?php if ($block): ?>
        <div class="title"><?php print $title; ?></div>
      <?php endif; ?>
      <?php print $choice; ?>
    </div>
    <?php print $vote; ?>
  </div>
  <?php // This is the 'rest' of the form, in case items have been added. ?>
  <?php print $rest ?>
</div>

Comments

jordanmagnuson’s picture

Issue summary: View changes

Updated issue summary.

jordanmagnuson’s picture

Title: Add poll-vote.tpl.php template file » Provide template files for actual polling forms
jordanmagnuson’s picture

Issue summary: View changes

Updated issue summary.

jordanmagnuson’s picture

Title: Provide template files for actual polling forms » Provide template files for actual voting forms

Here's what I've come up with as a starting point for advpoll-choice-form.tpl.php. These variables (specifically the $choices variable) would just need to be supplied via a preprocess function.

<?php
/**
 * @file
 * Theme implementation to display advpoll choice form.
 *
 * - $choices: The radio buttons or checkboxes for the choices in the poll.
 * - $submit: The vote button.
 * - $hidden: Hidden variables that need to be rendered for the form to function.
 *
 * @see template_preprocess_advpoll_choice_form()
 *
 * @ingroup themeable
 */
?>
<div class="poll advpoll">
  <div class="advpoll-choice-form">

    <div class="choices">
      <?php foreach ($choices as $key => $choice) { ?>
        <div class="choice choice-<?php print $key ?>">
          <div class="choice-text"><?php print $choice; ?></div>
        </div>
      <?php } ?>
    </div>

  <?php print $form['submit']; ?>
  <?php print $form['hidden']; ?>
  </div>
</div>

If someone can give me the go-ahead on this, I'd be happy to do the necessary preprocess and hook_theme work, and supply a patch.

jordanmagnuson’s picture

Issue summary: View changes

Updated issue summary.

tripper54’s picture

Category: Support request » Feature request
Issue summary: View changes

By all means, please submit a patch!