? custom_pagers_wrap.patch Index: custom_pagers.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/custom_pagers/custom_pagers.admin.inc,v retrieving revision 1.1 diff -u -p -r1.1 custom_pagers.admin.inc --- custom_pagers.admin.inc 17 Jun 2008 20:47:05 -0000 1.1 +++ custom_pagers.admin.inc 9 Jul 2009 15:32:08 -0000 @@ -183,6 +183,19 @@ function custom_pagers_form(&$form_state '#default_value' => $pid ? $pager->reverse_list : NULL ); + $form['node_list']['wrap'] = array( + '#type' => 'select', + '#title' => t('Wrap list'), + '#options' => array( + '' => 'None', + 'first' => t("First"), + 'last' => t("Last"), + 'both' => t("Both"), + ), + '#description' => t("Wrapping results will cause the first/last items in the list to jump to the start/end."), + '#default_value' => $pid ? $pager->wrap : NULL + ); + $form['node_list']['cache_list'] = array( '#type' => 'checkbox', '#title' => t('Cache the list of nodes'), Index: custom_pagers.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/custom_pagers/custom_pagers.install,v retrieving revision 1.3 diff -u -p -r1.3 custom_pagers.install --- custom_pagers.install 17 Jun 2008 20:47:05 -0000 1.3 +++ custom_pagers.install 9 Jul 2009 15:32:08 -0000 @@ -72,6 +72,13 @@ function custom_pagers_schema() { 'size' => 'tiny', 'description' => t("A boolean flag indicating that this {custom_pager} should be displayed in reverse order.") ), + 'wrap' => array( + 'type' => 'varchar', + 'length' => 16, + 'not null' => TRUE, + 'default' => '', + 'description' => t("How to wrap the results of this {custom_pager}.") + ), 'cache_list' => array( 'type' => 'int', 'not null' => TRUE, Index: custom_pagers.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/custom_pagers/custom_pagers.module,v retrieving revision 1.6 diff -u -p -r1.6 custom_pagers.module --- custom_pagers.module 17 Jun 2008 21:20:32 -0000 1.6 +++ custom_pagers.module 9 Jul 2009 15:32:08 -0000 @@ -307,6 +307,14 @@ function custom_pagers_preprocess_custom $pager = $vars['pager']; $nav = $vars['nav_array']; + if (empty($nav['prev']) && ($pager->wrap == 'first' || $pager->wrap == 'both')) { + $nav['prev'] = end($vars['nav_array']['full_list']); + } + + if (empty($nav['next']) && ($pager->wrap == 'last' || $pager->wrap == 'both')) { + $nav['next'] = reset($vars['nav_array']['full_list']); + } + $vars['previous'] = !empty($nav['prev']) ? l(t('‹ previous'), 'node/'. $nav['prev']) : ''; $vars['key'] = t('@count of @count_total', array('@count' => ($nav['current_index'] + 1), '@count_total' => count($nav['full_list']))); $vars['next'] = !empty($nav['next']) ? l(t('next ›'), 'node/'. $nav['next']) : '';