You are here

function pagination_preprocess_node in Pagination (Node) 7

Same name and namespace in other branches
  1. 6 pagination.module \pagination_preprocess_node()

Implementation of template_preprocess_node().

File

./pagination.module, line 289

Code

function pagination_preprocess_node(&$variables) {
  if ($variables['view_mode'] != 'full') {
    return;
  }
  $pg = Pagination::instance();
  $paging = $pg
    ->getValue($variables['type']);
  if ($paging) {
    $headers = $pg
      ->getHeaders($variables['node']->nid);
    $page = $pg
      ->getPageVar();
    if ($page == 0 || $page == 'show' || !isset($headers[$page])) {
      $title = drupal_get_title();
    }
    else {
      $title = $headers[$page];
    }
    $variables['pager'] = $pg
      ->getPager();
    $variables['pagination'] = (object) array(
      'page_header' => $title,
      'page_number' => $page,
    );
  }
}