Revision Views are not usable as field reference selection method

Created on 19 June 2025, 9 days ago

Problem/Motivation

What's the point of having a reference field that can target revisions if we cannot select revisions?!

Steps to reproduce

  1. Enable this module
  2. Create a View to show Revisions of content
  3. Add either/both an Entity Reference or/and an Entity Reference Revision display(s)
  4. Add an Entity Reference Revision field to a node type, select Views as selection method
  5. No eligible views were found

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.12

Component

Code

Created by

🇮🇹Italy kopeboy Milan

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

Comments & Activities

  • Issue created by @kopeboy
  • 🇮🇹Italy kopeboy Milan

    Even if you don't want to use Views for the selection method, I don't see revisions appear with the default autocomplete either!

  • 🇮🇹Italy kopeboy Milan

    I couldn't make a Views of revisions work as a reference method (it seems we need to change core?), so I made this field widget as a temporary workaround that provides an options select list of revisions.

    It filters for the allowed bundle from the entity_reference_revisions field's settings, revision author (uid) = current user, it removes current revisions, and displays max 10 results, sorted descending by creation timestamp. It even allows customizing the option text in the widget settings with @title, @date, @log substitutions (html tags will be stripped from the revision log message if present).

    Put it in your custom module or directly in entity_reference_revisions (fix the namespace at the top of the file accordingly), at /src/Plugin/Field/FieldWidget/CurrentUserRevisionSelectWidget.php and flush caches.

    I hope it helps and can even be included as a sub module.

  • 🇮🇹Italy kopeboy Milan

    Fixed the workaround widget.

  • 🇮🇹Italy kopeboy Milan

    Here a more robust alternative, that includes both a field widget "Select list of alternative revisions" (that no longer filters for the current user as author by default, but allows that as the widget configuration), and a field formatter "Configurable label + diff link", that allows configuring a label with substitutions, provides a button link to view the revision and, if diff module is enabled, another button to compare the selected revision with the current (default) revision.

Production build 0.71.5 2024