Problem/Motivation
#2974203: Redirect back to media list after creating a media entity β
caused a fairly serious regression for an unknown (presumably small) percentage of site admins. Although the title (and all of the discussion) focused on "redirect ... after creating a media entity", the patch that landed touches MediaForm::save()
such that all uses of a media form, including edit, get this forced redirect.
Steps to reproduce
- Clean install of Drupal 11.x
- Install the media module
- Visit: /admin/config/media/media-settings
- Enable the Standalone media URL
- Visit: /admin/content/media
- Add a simple media entity (image)
- Visit the media entity canonical url (/media/1) Admittedly, this is the rare step, but it happens, and the fact that media entities have a canonical view route means we need to support this case.
- Click the "Edit" tab, make any changes.
- Press "Save". <- Everyone expects to go back to the "View" tab, not sent off to an admin listing page.
Regardless of the behavior after adding a new entity (and if that should become a setting), it seems like editing an existing entity should never do this redirect, unless destination says so (which all the edit links on the media overview list already provide).
Content editor assumptions
view -> edit -> view : good
other -> edit -> other : good
view -> edit -> other : bad
Proposed resolution
Pick one:
A) Revert
#2974203: Redirect back to media list after creating a media entity β
. Patch in comment #3.
B) Fix the logic added in #2974203 to only happen on new entities, not when editing existing entities. Different behavior for edit vs. add cases. Patch in comment #4.
C) Add a single per-bundle setting for a shared redirect for both add and edit.
D) Separate per-bundle settings for redirect after add vs. edit.
E) Site-wide config setting to decide? Where?
F) Other?
Remaining tasks
Discuss possible solutions and pick one.
Implement.
Fix tests.
Commit.
User interface changes
Unknown.
At least fix the regression.
Possible new setting(s) to control behavior.
API changes
Hopefully none.
Data model changes
Possible new setting(s) to control behavior.