You are here

function poll_theme in Drupal 7

Same name and namespace in other branches
  1. 6 modules/poll/poll.module \poll_theme()

Implements hook_theme().

File

modules/poll/poll.module, line 32
Enables your site to capture votes on different topics in the form of multiple choice questions.

Code

function poll_theme() {
  $theme_hooks = array(
    'poll_vote' => array(
      'template' => 'poll-vote',
      'render element' => 'form',
    ),
    'poll_choices' => array(
      'render element' => 'form',
    ),
    'poll_results' => array(
      'template' => 'poll-results',
      'variables' => array(
        'raw_title' => NULL,
        'results' => NULL,
        'votes' => NULL,
        'raw_links' => NULL,
        'block' => NULL,
        'nid' => NULL,
        'vote' => NULL,
      ),
    ),
    'poll_bar' => array(
      'template' => 'poll-bar',
      'variables' => array(
        'title' => NULL,
        'votes' => NULL,
        'total_votes' => NULL,
        'vote' => NULL,
        'block' => NULL,
      ),
    ),
  );

  // The theme system automatically discovers the theme's functions and
  // templates that implement more targeted "suggestions" of generic theme
  // hooks. But suggestions implemented by a module must be explicitly
  // registered.
  $theme_hooks += array(
    'poll_results__block' => array(
      'template' => 'poll-results--block',
      'variables' => $theme_hooks['poll_results']['variables'],
    ),
    'poll_bar__block' => array(
      'template' => 'poll-bar--block',
      'variables' => $theme_hooks['poll_bar']['variables'],
    ),
  );
  return $theme_hooks;
}