function custom_pager_build_nav in Custom Pagers 7
Same name and namespace in other branches
- 5 custom_pagers.module \custom_pager_build_nav()
 - 6 custom_pagers.module \custom_pager_build_nav()
 
2 calls to custom_pager_build_nav()
- custom_pagers_block_view in ./
custom_pagers.module  - Implements hook_block_view().
 - custom_pagers_node_view in ./
custom_pagers.module  - Implements hook_node_view().
 
File
- ./
custom_pagers.module, line 231  - Allows administrators to define context-sensitive previous/next pagers for any node type.
 
Code
function custom_pager_build_nav($pager, $node) {
  static $pager_cache;
  $list = array();
  // Let's build it from scratch!
  if (empty($list)) {
    // If the pager uses PHP, execute the PHP and run with the list.
    // Otherwise, use a view to get a list of node ids.
    if (!empty($pager->list_php)) {
      // Use PHP code to generate the list.
      ob_start();
      $result = eval(trim($pager->list_php));
      if (is_array($result)) {
        $list = $result;
      }
      ob_end_clean();
    }
    elseif ($results = custom_pagers_get_list_from_view($pager, $node)) {
      $list = $results;
    }
    if ($pager->reverse_list) {
      $list = array_reverse($list);
    }
  }
  return pager_entries_by_val($node->nid, $list);
}