itpatrol/altpager

Two nodes on the site

sergeypavlenko opened this issue · 1 comments

Hi

If a site such as two nodes, the module will display the following:

altpager-show-none

Can do the condition: if field $items is empty, then only derive maximum value. Then get:

altpager-show

Code function _template_preprocess_altpager()_:

function template_preprocess_altpager(&$variables) {
  $max_count = altpager_count_all_items();

  drupal_add_css(drupal_get_path('module', 'altpager') . '/altpager.css');

  $variables['items'] = '';
  $items = altpager_default_items();
  $min_count = key($items);

  if ($max_count > $min_count) {
    foreach ($items as $count => $title) {
      if ($count <= $max_count) {
        $variables['items'] .= theme('altpager_link', array(
          'count' => $count,
          'title' => $title,
        ));
      }
    }
  }

  if (empty($variables['items'])) {
    $variables['items'] .= $max_count;
  }

  $variables['total'] = $max_count;
}

New code:

if (empty($variables['items'])) {
  $variables['items'] .= $max_count;
}

Or the decision to commit was the best? 9a6c3a8

With my decision, people will see that you are using paginator.