When on the last page the next link is grayed out and on the first page the previous link is grayed out. There is no way to hide the links in this case through the interface and there is no class provided for first/last to hide through css.

This can especially be an issue if you are using token replacement added in https://www.drupal.org/node/2870793. If you were to use [node:title] in the link, on the last page the next link would show the title of the current page, but grayed out, which is confusing.

I was able to solve this for my case in the entity-pager.html.twig by checking the type of link {% if link['#type'] == 'link' %}. But this would also hide the page count if a user was using this.

Comments

chriswinger created an issue. See original summary.

chriswinger’s picture

Title: Add ability to hide next/prev link if on last/prev page respectively » Add ability to hide next/prev link if on last/first page respectively
replicaobscura’s picture

Assigned: Unassigned » replicaobscura

I've added a 'Show disabled links' option to the display settings, which is enabled by default. Unchecking this should hide the disabled prev/next links. Let me know if you run into any issues with this implementation.

Committing shortly.

  • bmcclure committed a73eadd on 8.x-1.x
    Issue #2889495 by chriswinger, bmcclure: Add ability to hide next/prev...
replicaobscura’s picture

Status: Active » Fixed

Thanks again for the report!

Fix is in dev, and will be in a new release soon.

Status: Fixed » Closed (fixed)

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

JmOkay’s picture

https://www.drupal.org/node/2870646#comment-12204369 ...this solution will simplify your code plus cover this scenario + unforeseen future requests in this area.

All the best - JmOkay