Skip to content

Commit f26d023

Browse files
committed
1 parent 661db0e commit f26d023

2 files changed

Lines changed: 25 additions & 8 deletions

File tree

core/misc/dialog/dialog.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
openDialog({modal: true});
7676
},
7777
close: closeDialog,
78-
container: getContainer,
79-
options: setOptions,
78+
getContainer: getContainer,
79+
setOptions: setOptions,
8080
handleDialogResize: handleDialogResize
8181
};
8282

@@ -97,12 +97,29 @@
9797
$(window).trigger('dialog:afterclose', [dialog, $element]);
9898
}
9999

100+
/**
101+
* Gets the HTMLElement that contains the dialog.
102+
*
103+
* jQuery UI dialogs are contained in outer HTMLElement.
104+
* For themes or modules that override the Drupal.dialog with non jQuery UI
105+
* dialogs that do not have a containing element other than the dialog
106+
* itself should just return the dialog element.
107+
*
108+
* @return {HTMLElement} element
109+
* The HTMLElement that contains the dialog.
110+
*/
100111
function getContainer() {
101112
return $element.dialog('widget')[0];
102113
}
103114

104-
function setOptions($options) {
105-
$element.dialog('option', $options);
115+
/**
116+
* Sets the options for the dialog.
117+
*
118+
* @param {object} options
119+
* jQuery UI options to be passed to the dialog.
120+
*/
121+
function setOptions(options) {
122+
$element.dialog('option', options);
106123
}
107124

108125
/**

core/modules/outside_in/js/off-canvas.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
var offsets = displace.offsets;
3535
var $element = event.data.$element;
3636
var dialog = event.data.dialog;
37-
var $container = $(dialog.container());
37+
var $container = $(dialog.getContainer());
3838

3939
var adjustedOptions = {
4040
// @see http://api.jqueryui.com/position/
@@ -50,7 +50,7 @@
5050
height: ($(window).height() - (offsets.top + offsets.bottom)) + 'px'
5151
});
5252

53-
dialog.options(adjustedOptions);
53+
dialog.setOptions(adjustedOptions);
5454
$element.trigger('dialogContentResize.off-canvas');
5555
}
5656

@@ -66,7 +66,7 @@
6666
if ($('body').outerWidth() < minDisplaceWidth) {
6767
return;
6868
}
69-
var $container = $(event.data.dialog.container());
69+
var $container = $(event.data.dialog.getContainer());
7070

7171
var width = $container.outerWidth();
7272
var mainCanvasPadding = $mainCanvasWrapper.css('padding-' + edge);
@@ -100,7 +100,7 @@
100100
.on('dialogContentResize.off-canvas', eventData, debounce(bodyPadding, 100))
101101
.trigger('dialogresize.off-canvas');
102102

103-
$(dialog.container()).attr('data-offset-' + edge, '');
103+
$(dialog.getContainer()).attr('data-offset-' + edge, '');
104104

105105
$(window)
106106
.on('resize.off-canvas scroll.off-canvas', eventData, debounce(resetSize, 100))

0 commit comments

Comments
 (0)