Currently there is no hook that would allow extensions to modify the rollback links in MW's interface appearing in various places (history, RC, diffs etc.).
It would be valuable if extensions could modify the default rollback link provided by MW. For example, the rollback method could be changed to AJAX-based, or more rollback methods could be added, such as reverting with a reason given.
Currently the only solution to a use case like this would be to modify HTML output, which would be very error-prone and ugly. Another solution would be to trigger a lot of JS on page load to modify the DOM, but that slows down page loading, creates additional flickering and does not work properly with features like enhanced RC.
We would use this hook to implement an extension that improves user experience in moderation (patrolling, reverting, etc.). See the relevant task here: https://gitlab.com/nonsensopedia/extensions/fancymoderation/-/issues/1
LinkerGenerateRollbackLink is called in Linker::generateRollback static method after all important checks against the DB are done, but before any prettyfication of the link. This is to avoid code duplication in extensions and simplify hook implementation.
The extension can also return false to indicate no further processing of the link is needed. This may be useful if the extension wants full control over the link's appearance.
The hook passes these parameters:
- $revision – the top revision to roll back.
- $context – IContextSource provided by the caller.
- $options – array of options passed to the method.
- &$inner – modifiable HTML of the link.