Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
|
@ -1,19 +1,75 @@
|
|||
/**
|
||||
* @file
|
||||
* Javascript behaviors to fix dialogs.
|
||||
* JavaScript behaviors for webform dialogs.
|
||||
*/
|
||||
|
||||
(function ($, Drupal) {
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
|
||||
'use strict';
|
||||
|
||||
// @see http://stackoverflow.com/questions/20533487/how-to-ensure-that-ckeditor-has-focus-when-displayed-inside-of-jquery-ui-dialog
|
||||
var _allowInteraction = $.ui.dialog.prototype._allowInteraction;
|
||||
$.ui.dialog.prototype._allowInteraction = function (event) {
|
||||
if ($(event.target).closest('.cke_dialog').length) {
|
||||
return true;
|
||||
// @see http://api.jqueryui.com/dialog/
|
||||
Drupal.webform = Drupal.webform || {};
|
||||
Drupal.webform.dialog = Drupal.webform.dialog || {};
|
||||
Drupal.webform.dialog.options = Drupal.webform.dialog.options || {};
|
||||
|
||||
/**
|
||||
* Open webform dialog using preset options.
|
||||
*
|
||||
* @type {Drupal~behavior}
|
||||
*/
|
||||
Drupal.behaviors.webformDialog = {
|
||||
attach: function (context) {
|
||||
$('a.webform-dialog', context).once('webform-dialog').each(function () {
|
||||
var $a = $(this);
|
||||
|
||||
// Get default options.
|
||||
var options = $.extend({}, Drupal.webform.dialog.options);
|
||||
|
||||
// Get preset dialog options.
|
||||
if ($a.attr('class').match(/webform-dialog-([a-z0-9_]+)/)) {
|
||||
var dialogOptionsName = RegExp.$1;
|
||||
if (drupalSettings.webform.dialog.options[dialogOptionsName]) {
|
||||
options = drupalSettings.webform.dialog.options[dialogOptionsName];
|
||||
|
||||
// Unset title.
|
||||
delete options.title;
|
||||
}
|
||||
}
|
||||
|
||||
// Get custom dialog options.
|
||||
if ($(this).data('dialog-options')) {
|
||||
$.extend(options, $(this).data('dialog-options'));
|
||||
}
|
||||
|
||||
var href = $a.attr('href');
|
||||
|
||||
// Replace ENTITY_TYPE and ENTITY_ID placeholders and update the href.
|
||||
// @see webform_page_attachments()
|
||||
if (href.indexOf('?source_entity_type=ENTITY_TYPE&source_entity_id=ENTITY_ID') !== -1) {
|
||||
if (drupalSettings.webform.dialog.entity_type && drupalSettings.webform.dialog.entity_id) {
|
||||
href = href.replace('ENTITY_TYPE', encodeURIComponent(drupalSettings.webform.dialog.entity_type));
|
||||
href = href.replace('ENTITY_ID', encodeURIComponent(drupalSettings.webform.dialog.entity_id));
|
||||
}
|
||||
else {
|
||||
href = href.replace('?source_entity_type=ENTITY_TYPE&source_entity_id=ENTITY_ID', '');
|
||||
}
|
||||
$a.attr('href', href);
|
||||
}
|
||||
|
||||
// Append _webform_dialog=1 to href to trigger Ajax support.
|
||||
// @see \Drupal\webform\WebformSubmissionForm::setEntity
|
||||
href += (href.indexOf('?') === -1 ? '?' : '&') + '_webform_dialog=1';
|
||||
|
||||
var element_settings = {};
|
||||
element_settings.progress = {type: 'fullscreen'};
|
||||
element_settings.url = href;
|
||||
element_settings.event = 'click';
|
||||
element_settings.dialogType = $a.data('dialog-type') || 'modal';
|
||||
element_settings.dialog = options;
|
||||
element_settings.element = this;
|
||||
Drupal.ajax(element_settings);
|
||||
});
|
||||
}
|
||||
return _allowInteraction.apply(this, arguments);
|
||||
};
|
||||
|
||||
})(jQuery, Drupal);
|
||||
})(jQuery, Drupal, drupalSettings);
|
||||
|
|
Reference in a new issue