Previous and next navigation through block or twig function

Created on 28 August 2025, 5 days ago

Problem/Motivation

DraggableViews saving order between nodes on its own database table, would that be difficult to provide a prev/next block that could be displayed on each node as a navigation menu.

  • "prev" link should be hidden on first item as well as "next" on last item.
  • "prev" and "last" labels should be set as wished with token as in Β« [node:title] (with localization support).

I can even imagine it as a twig function as in:

{{ draggableviews(NODE_ID, PREV_NEXT, LINK_TEXT, {
  class: 'foo-class'
}) }}
  1. NODE_ID: the node id for which to display the link (so we can have the link displayed in another template than the node one), either an integer or a previously set twig variable, it's the id of the node used as ref. for the prev or next link, not the prev or next node itself
  2. PREV_NEXT: a keyword to either display 'prev', 'next' link (not both), in relation with given NODE_ID
  3. LINK_TEXT: a custom text, usually the linked node label, but could it be dynamic like in {{ "Β« " ~ label }}
  4. last argument being an optional array of attributes for the link
✨ Feature request
Status

Active

Version

2.1

Component

Code

Created by

πŸ‡«πŸ‡·France PhilY πŸ‡ͺπŸ‡ΊπŸ‡«πŸ‡· Paris, France

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024