Problem/Motivation

ajax_comments_preprocess_pager() updates pager items with its own href per item. However, it overwrites all other attributes that may have been defined on a pager item.

Steps to reproduce

  1. Set a css class on a pager item in pager.html.twig, for example:
    <a href="{{ items.next.href }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes.addClass('pager__link', 'pager__link--next')|without('href', 'title', 'rel') }}>
  2. Enable AJAX Comments and observe the attribute is no longer printed.

Proposed resolution

Only change the href attribute for pager items. Leave the other attributes as is.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

None.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#2 3166090-2.patch2.15 KBidebr

Comments

idebr created an issue. See original summary.

idebr’s picture

Status: Active » Needs review
StatusFileSize
new2.15 KB

Attached patch updates ajax_comments_preprocess_pager() so the function changes the href attribute only for pager items. Other attributes are left untouched.

qzmenko’s picture

Assigned: Unassigned » qzmenko

  • qzmenko committed 03f7ba7 on 8.x-1.x authored by idebr
    Issue #3166090 by idebr, qzmenko: ajax_comments_preprocess_pager...
qzmenko’s picture

Assigned: qzmenko » Unassigned
Status: Needs review » Fixed

Commited, thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.