comparison core/lib/Drupal/Core/Ajax/OpenOffCanvasDialogCommand.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
32 * jQuery UI option can be used. See http://api.jqueryui.com/dialog. 32 * jQuery UI option can be used. See http://api.jqueryui.com/dialog.
33 * @param array|null $settings 33 * @param array|null $settings
34 * (optional) Custom settings that will be passed to the Drupal behaviors 34 * (optional) Custom settings that will be passed to the Drupal behaviors
35 * on the content of the dialog. If left empty, the settings will be 35 * on the content of the dialog. If left empty, the settings will be
36 * populated automatically from the current request. 36 * populated automatically from the current request.
37 * @param string $position
38 * (optional) The position to render the off-canvas dialog.
37 */ 39 */
38 public function __construct($title, $content, array $dialog_options = [], $settings = NULL) { 40 public function __construct($title, $content, array $dialog_options = [], $settings = NULL, $position = 'side') {
39 parent::__construct('#drupal-off-canvas', $title, $content, $dialog_options, $settings); 41 parent::__construct('#drupal-off-canvas', $title, $content, $dialog_options, $settings);
40 $this->dialogOptions['modal'] = FALSE; 42 $this->dialogOptions['modal'] = FALSE;
41 $this->dialogOptions['autoResize'] = FALSE; 43 $this->dialogOptions['autoResize'] = FALSE;
42 $this->dialogOptions['resizable'] = 'w'; 44 $this->dialogOptions['resizable'] = 'w';
43 $this->dialogOptions['draggable'] = FALSE; 45 $this->dialogOptions['draggable'] = FALSE;
44 $this->dialogOptions['drupalAutoButtons'] = FALSE; 46 $this->dialogOptions['drupalAutoButtons'] = FALSE;
47 $this->dialogOptions['drupalOffCanvasPosition'] = $position;
45 // @todo drupal.ajax.js does not respect drupalAutoButtons properly, pass an 48 // @todo drupal.ajax.js does not respect drupalAutoButtons properly, pass an
46 // empty set of buttons until https://www.drupal.org/node/2793343 is in. 49 // empty set of buttons until https://www.drupal.org/node/2793343 is in.
47 $this->dialogOptions['buttons'] = []; 50 $this->dialogOptions['buttons'] = [];
48 if (empty($dialog_options['dialogClass'])) { 51 if (empty($dialog_options['dialogClass'])) {
49 $this->dialogOptions['dialogClass'] = 'ui-dialog-off-canvas'; 52 $this->dialogOptions['dialogClass'] = "ui-dialog-off-canvas ui-dialog-position-$position";
50 } 53 }
51 // If no width option is provided then use the default width to avoid the 54 // If no width option is provided then use the default width to avoid the
52 // dialog staying at the width of the previous instance when opened 55 // dialog staying at the width of the previous instance when opened
53 // more than once, with different widths, on a single page. 56 // more than once, with different widths, on a single page.
54 if (!isset($this->dialogOptions['width'])) { 57 if (!isset($this->dialogOptions['width'])) {