You are here

function social_comment_preprocess_pager in Open Social 10.2.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_comment/social_comment.module \social_comment_preprocess_pager()
  2. 10.0.x modules/social_features/social_comment/social_comment.module \social_comment_preprocess_pager()
  3. 10.1.x modules/social_features/social_comment/social_comment.module \social_comment_preprocess_pager()

Implements hook_preprocess_pager().

File

modules/social_features/social_comment/social_comment.module, line 377
The Social comment module.

Code

function social_comment_preprocess_pager(&$variables) {
  $items =& $variables['items'];
  $pattern = '/%2C.$/';
  if (empty($items)) {
    return;
  }

  // Change href for all pager items except "pages"
  // (E.G. first, previous, next, last, etc.).
  foreach ($items as $key => $item) {
    if (isset($item['href'])) {
      $items[$key]['href'] = preg_replace($pattern, '', $item['href']);
    }
  }

  // Change href for pager "pages" items.
  foreach ($items['pages'] as $key => &$item) {
    $items['pages'][$key]['href'] = preg_replace($pattern, '', $item['href']);
  }
}