2291249 Modal display

$this is added to form structure here. Form is serialized and cached on AJAX requests, which ends up in fatals

> User error: The container was serialized. in Drupal\Core\DependencyInjection\Container->__sleep() (line 34 of /var/www/drupal8/core/lib/Drupal/Core/DependencyInjection/Container.php).

and 

> BadMethodCallException: Settings cannot be serialized. in Drupal\Core\Site\Settings->__sleep() (line 66 of /var/www/drupal8/core/lib/Drupal/Core/Site/Settings.php).

In order to prevent this you need to implement __sleep() and __wakeup() magic methods on this class. See EntityBrowser.php for an example. Also see https://github.com/drupal-media/entity_browser/pull/39 which re-enables form cache and tries to fix problems that I noticed related to that. It would be great if we could test this code with that PR merged in.