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

Primsi created an issue. See original summary.

Primsi’s picture

I 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.

slashrsm’s picture

Priority: Normal » Major
Primsi’s picture

Status: Active » Needs review

An 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:

  • implement the "only-content" theme for the page in the html theme
  • figure out why the Modal object properties are null on if I press the open modal button for a second time
slashrsm’s picture

Status: Needs review » Needs work
Issue tags: +Media Initiative, +D8Media

Direction looks OK. I've left few comments on pull. Most of things can be done in follow-ups.

Primsi’s picture

Status: Needs work » Needs review

I'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.

slashrsm’s picture

Status: Needs review » Fixed

Merged. Thanks!

  • slashrsm committed adae28a on 8.x-1.x authored by Primsi
    Issue #2569569 by Primsi: Make modal display plugin use iframe
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.