Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / misc / dialog / dialog.jquery-ui.es6.js
1 /**
2  * @file
3  * Adds default classes to buttons for styling purposes.
4  */
5
6 (function ($) {
7   $.widget('ui.dialog', $.ui.dialog, {
8     options: {
9       buttonClass: 'button',
10       buttonPrimaryClass: 'button--primary',
11     },
12     _createButtons() {
13       const opts = this.options;
14       let primaryIndex;
15       let index;
16       const il = opts.buttons.length;
17       for (index = 0; index < il; index++) {
18         if (opts.buttons[index].primary && opts.buttons[index].primary === true) {
19           primaryIndex = index;
20           delete opts.buttons[index].primary;
21           break;
22         }
23       }
24       this._super();
25       const $buttons = this.uiButtonSet.children().addClass(opts.buttonClass);
26       if (typeof primaryIndex !== 'undefined') {
27         $buttons.eq(index).addClass(opts.buttonPrimaryClass);
28       }
29     },
30   });
31 }(jQuery));