You are here

function cleanpager_preprocess_views_mini_pager in Clean Pagination 8

Implements template_preprocess_views_mini_pager().

File

./cleanpager.module, line 102
Fto Clean Pager module file.

Code

function cleanpager_preprocess_views_mini_pager(&$variables) {
  global $pager_page_array, $pager_total;
  $tags =& $variables['tags'];
  $element = $variables['element'];
  $parameters = $variables['parameters'];
  $variables['items']['current'] = $pager_page_array[$element] + 1;
  if ($pager_total[$element] > 1 && $pager_page_array[$element] > 0) {
    $options = array(
      'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] - 1),
    );
    $variables['items']['previous']['href'] = _cleanpager_url('<none>', [], $options);
    if (isset($tags[1])) {
      $variables['items']['previous']['text'] = $tags[1];
    }
    $variables['items']['previous']['attributes'] = new Attribute();
  }
  if ($pager_page_array[$element] < $pager_total[$element] - 1) {
    $options = array(
      'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] + 1),
    );
    $variables['items']['next']['href'] = _cleanpager_url('<none>', [], $options);
    if (isset($tags[3])) {
      $variables['items']['next']['text'] = $tags[3];
    }
    $variables['items']['next']['attributes'] = new Attribute();
  }
  $variables['#cache']['contexts'][] = 'url.query_args';
}