File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
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 /**
Original file line number Diff line number Diff line change 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/
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
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 ) ;
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 ) )
You can’t perform that action at this time.
0 commit comments