Problem/Motivation
Discovered while implementing #2702353: Vertical tab for listing redirects to content/entities missing:
One thing I noticed is that there is currently no destination, so after deleting, you end back on the overview, but that will be fixed automatically in 8.5.x. The more problematic part is that it is quite easy to lose data, because clicking on those operations will lose all data that has been customized on the form. Not sure what to do about that, I guess it was the same in 7.x.
- Berdir in #42
Proposed resolution
Allow the user to administer redirects within the page without leaving the node form by either:
- implementing a modal form when editing / deleting / adding a redirect
- using ajax to inline the edit / delete / add form
Remaining tasks
- Discuss resolution
- Write a patch
- Review
- Commit
User interface changes
To be determined.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | redirect-off-canvas.gif | 1.04 MB | idebr |
Comments
Comment #2
idebr commentedNo longer postponed since #2702353: Vertical tab for listing redirects to content/entities missing has been committed.
Comment #3
idebr commentedComment #4
dwwI think I'd prefer inline manipulation of all related redirects via AJAX, much like inline entity form.
I suppose a modal would work, too, but I tend to hate those. ;)
I don't think we can actually use IEF directly for this, but certainly we could borrow some ideas/code/approach.
Agreed it'd be nice to make this more slick. Not sure I'll have time to work on this as part of my current gig, but I'll see if I can get them to sponsor a few hours to start making this work.
I'd love input/direction from the redirect maintainers before I get too deep into this.
Thanks!
-Derek
Comment #5
idebr commentedAlternatively Redirect could support the Off-Canvas dialog introduced in Drupal 8.5.x. This is the default interaction method when working with the Webform module:
Comment #6
dww@idebr: how did you make that gif? Can you attach a patch (even if initial and proof-of-concept) as a basis for moving this forward?
Thanks!
-Derek
Comment #7
dwwA little searching showed me how relatively easy this is. Basically, you need this on the link render array:
However, when I tried using off_canvas for #2958635: Restore link to add a redirect on node edit forms, I had a problem that after I successfully created the new redirect via the dialog, once the dialog closed and the host entity form took the full screen again, any in-progress changes to the host entity form were lost and it was as-if the whole form was reloaded. :/ Sure, that means the new redirect now appears in the table of redirects, but e.g. in-progress changes to the title, body, whatever are still getting lost. Making this more slick but leaving #1473288: You lose unsaved content, if you add/edit/delete a redirect on node edit form broken doesn't seem worth it. I was hoping this issue would be the clean way to fix that bug. I haven't dug deeply, yet, but that seems like a flaw in the stock off_canvas support. I haven't had time to dive into the code to understand why this is happening, and why something like the "Add another item" AJAX button on multi-valued fields or the behavior from IEF isn't there. Anyone have any quick pointers on this? I'd be interested in helping move this issue forward, but I don't want to sink too many hours into FAPI/AJAX debugging hell to get to the bottom of it. ;)
Thanks!
-Derek
p.s. Should we call this issue dup of #1473288: You lose unsaved content, if you add/edit/delete a redirect on node edit form and move this energy back over there? Seems like they're both trying to solve the same problem.
Comment #8
mpp commented