You are here

function advanced_forum_preprocess_advanced_forum_topic_pager in Advanced Forum 7.2

Preprocess forum topic pager.

File

includes/theme.inc, line 270
Holds theme functions and template preprocesses. Other style related functions are in style.inc

Code

function advanced_forum_preprocess_advanced_forum_topic_pager(&$variables) {
  $pagecount = $variables['pagecount'];
  $topic = $variables['topic'];

  // Get the information to assemble the pager. This returns an object with
  // the following properties:
  // - initial_pages: Array of linked numbers for first set of pages
  // - last_page_text: Linked text "Last page" (translatable)
  // - last_page_number: Linked number pointing to the last page.
  $topic_pager = advanced_forum_create_topic_pager($pagecount, $topic);
  $variables['last_page_text'] = '';
  if (!empty($topic_pager->initial_pages)) {
    $variables['pages'] = $topic_pager->initial_pages;
    if (!empty($topic_pager->last_page_text)) {
      $variables['last_page'] = $topic_pager->last_page;
      $variables['last_page_text'] = $topic_pager->last_page_text;
      $variables['last_page_number'] = $topic_pager->last_page_number;

      // If you prefer to end with the number, replace
      // $topic_pager->last_page_text with $topic_pager->last_page_number
      $variables['last_page_text'] = ' … ' . $topic_pager->last_page_text;
    }
  }
}