Add previous/next record navigation to backend forms - #1510
Merged
Conversation
Adds an optional, opt-out `recordNavigation` feature that renders a compact previous/next control in the breadcrumb row of update/preview forms, letting operators step through the sibling records of the controller's list while honouring its active filters, search and sorting. The position math (`resolveRecordPosition`) is a pure, database-agnostic helper: the ordered keys are read once via a portable `pluck` and the current record's neighbours are resolved in PHP — no driver-specific SQL (no `@row_num` session variables, no version-gated window functions) — so it behaves identically across every database Winter supports. - `FormController::formGetRecordNavigation()` / `formRenderRecordNavigation()` plus the pure `resolveRecordPosition()` helper - Rendered via `formcontroller/partials/_record_navigation.php`, wired into the standard/sidebar/fancy update and preview layouts - Enabled by default; opt out with `recordNavigation: false` in config_form.yaml - Unit tests for the position math; styles in `controls/record-navigation.less` Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
LukeTowers
added a commit
that referenced
this pull request
Aug 13, 2026
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional record navigation control to backend forms: a compact
current / totalindicator with previous/next arrows pinned to the right of the breadcrumb row onupdate/previewpages. It lets operators step through the sibling records of the controller's list without returning to it, honouring the list's active filters, search and sorting.Enabled by default; opt out per controller with
recordNavigation: falseinconfig_form.yaml. Renders nothing when the controller has noListControllerbehaviour or when creating a new record.Why / cross-database
Projects commonly hand-roll this per controller with a MySQL-only
SET @row_numtrick that breaks on SQLite/Postgres/SQL Server. This keeps the position math database-agnostic:pluck, and the current record's neighbours are resolved in PHP via the pureresolveRecordPosition()helper — no driver-specific SQL, no window functions, no session variables.What's included
FormController::formGetRecordNavigation()+formRenderRecordNavigation(), and the pureresolveRecordPosition()helperformcontroller/partials/_record_navigation.php, wired into the standard/sidebar/fancyupdateandpreviewlayoutsbackend::lang.form.record_navigation/previous_record/next_recordassets/less/controls/record-navigation.lessFormControllerRecordNavigationTest(empty / first / middle / last / not-found / loose-typed / string keys)Screenshots
Notes
recordNavigationdefaults totrue; setfalseto disable per controller.ctrl/cmd+ up (previous), + down (next).🤖 Generated with Claude Code