You are here

function _social_ajax_comments_pager in Open Social 10.2.x

Same name and namespace in other branches
  1. 10.3.x modules/custom/social_ajax_comments/social_ajax_comments.module \_social_ajax_comments_pager()
  2. 10.0.x modules/custom/social_ajax_comments/social_ajax_comments.module \_social_ajax_comments_pager()
  3. 10.1.x modules/custom/social_ajax_comments/social_ajax_comments.module \_social_ajax_comments_pager()

Add the CSS class to each element of a pager.

Parameters

array $items: The pager sub-elements.

1 call to _social_ajax_comments_pager()
social_ajax_comments_preprocess_pager in modules/custom/social_ajax_comments/social_ajax_comments.module
Implements hook_preprocess_HOOK().

File

modules/custom/social_ajax_comments/social_ajax_comments.module, line 223
The Social AJAX comments module.

Code

function _social_ajax_comments_pager(array &$items) {
  foreach ($items as &$item) {
    if (isset($item['href'])) {
      $attributes = $item['attributes'] ?? new Attribute([]);
      $attributes
        ->addClass('use-ajax');
      $item['attributes'] = $attributes;
    }
  }
}