X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Foutside_in%2Fsrc%2FAjax%2FOpenOffCanvasDialogCommand.php;h=2371483ed531b847c9dbcd087c96f75dc12a190a;hp=9989d91f652745abb9cd4f84d3776d82c0feadb0;hb=bfbba508964731508b9bd6d5835c2edc858db95b;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae diff --git a/web/core/modules/outside_in/src/Ajax/OpenOffCanvasDialogCommand.php b/web/core/modules/outside_in/src/Ajax/OpenOffCanvasDialogCommand.php index 9989d91f6..2371483ed 100644 --- a/web/core/modules/outside_in/src/Ajax/OpenOffCanvasDialogCommand.php +++ b/web/core/modules/outside_in/src/Ajax/OpenOffCanvasDialogCommand.php @@ -11,6 +11,11 @@ use Drupal\Core\Ajax\OpenDialogCommand; */ class OpenOffCanvasDialogCommand extends OpenDialogCommand { + /** + * The dialog width to use if none is provided. + */ + const DEFAULT_DIALOG_WIDTH = 300; + /** * Constructs an OpenOffCanvasDialogCommand object. * @@ -42,6 +47,12 @@ class OpenOffCanvasDialogCommand extends OpenDialogCommand { // @todo drupal.ajax.js does not respect drupalAutoButtons properly, pass an // empty set of buttons until https://www.drupal.org/node/2793343 is in. $this->dialogOptions['buttons'] = []; + // If no width option is provided then use the default width to avoid the + // dialog staying at the width of the previous instance when opened + // more than once, with different widths, on a single page. + if (!isset($this->dialogOptions['width'])) { + $this->dialogOptions['width'] = static::DEFAULT_DIALOG_WIDTH; + } } /**