Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As per discussion at NYC camp. We should make the modal display plugin show content in an iframe.
Problem/motivation
Anything but the simplest operations cause the modal to close or/and to be redirected to a different page. Ie. following a pager link, submitting an exposed views form.
Proposed resolution
Display the content of the modal in an iframe.
Comments
Comment #2
Primsi CreditAttribution: Primsi at Examiner.com for Examiner.com commentedI started working on this. Approached it like that:
- created a new controller for the modal page that returns the open modal ajax response
- changed the display annotation so we can specify which controller the display uses. A temporary solution until #2364193 is done
- use the display controller when creating routes
Using this approach I still need to figure out how to display the actual content in the iframe, because the modal route now uses the modal controller which returns commands not content.
Comment #3
slashrsm CreditAttribution: slashrsm at Examiner.com commentedComment #4
Primsi CreditAttribution: Primsi at Examiner.com for Examiner.com commentedAn initial stab at this. Still needs cleanup, some more testing and more work: https://github.com/drupal-media/entity_browser/pull/111
Just want to make sure that the direction is ok.
I've yet to fix:
mplement the "only-content" theme for the page in the html themefigure out why the Modal object properties are null on if I press the open modal button for a second timeComment #5
slashrsm CreditAttribution: slashrsm at Examiner.com commentedDirection looks OK. I've left few comments on pull. Most of things can be done in follow-ups.
Comment #6
Primsi CreditAttribution: Primsi at Examiner.com for Examiner.com commentedI've fixed the stuff I mentioned in my previous comment and I will open follow ups when this gets in.
I didn't find a way to use $form_state->get('path') in the openModal method, so I left it as it is. I thought that because it's us, who set the path element value, there shouldn't be any security concerns getting the value from input. Although admittedly not as pretty as it would be by doing that via get.
Comment #7
Primsi CreditAttribution: Primsi at Examiner.com for Examiner.com commentedFollow ups:
Comment #8
slashrsm CreditAttribution: slashrsm at Examiner.com commentedMerged. Thanks!