You are here

function i18npoll_view in Internationalization 6

Implementation of hook_view().

Parameters

$block: An extra parameter that adapts the hook to display a block-ready rendering of the poll.

1 call to i18npoll_view()
i18npoll_block in i18npoll/i18npoll.module
Implementation of hook_block().

File

i18npoll/i18npoll.module, line 94
Multilingual poll - Aggregates poll results for all translations.

Code

function i18npoll_view($node, $teaser = FALSE, $page = FALSE, $block = FALSE) {
  global $user;
  $output = '';

  // Special display for side-block.
  if ($block) {

    // No 'read more' link.
    $node->readmore = FALSE;
    $links = module_invoke_all('link', 'node', $node, 1);
    $links[] = array(
      'title' => t('Older polls'),
      'href' => 'poll',
      'attributes' => array(
        'title' => t('View the list of polls on this site.'),
      ),
    );
    if ($node->allowvotes && $block) {
      $links[] = array(
        'title' => t('Results'),
        'href' => 'node/' . $node->nid . '/results',
        'attributes' => array(
          'title' => t('View the current poll results.'),
        ),
      );
    }
    $node->links = $links;
  }
  if (!empty($node->allowvotes) && ($block || empty($node->show_results))) {
    $node->content['body'] = array(
      '#value' => drupal_get_form('poll_view_voting', $node, $block),
    );
  }
  else {
    $node->content['body'] = array(
      '#value' => i18npoll_view_results($node, $teaser, $page, $block),
    );
  }
  return $node;
}