Problem/Motivation

The function expects 1 argument, but 2 were provided.
```
File: viewsreference/js/viewsreference.js:
(function ($) {

"use strict";

/**
* Handles an autocompleteselect event.
*
* Override the autocomplete method to add a custom event.
*
* @param {jQuery.Event} event
* The event triggered.
* @param {object} ui
* The jQuery UI settings object.
*
* @return {bool}
* Returns false to indicate the event status.
*/
Drupal.autocomplete.options.select = function selectHandler(event, ui) {
var terms = Drupal.autocomplete.splitValues(event.target.value);
// Remove the current input.
terms.pop();
// Add the selected item.
if (ui.item.value.search(',') > 0) {
terms.push('"' + ui.item.value + '"');
}
else {
terms.push(ui.item.value);
}
event.target.value = terms.join(', ');
// Fire custom event that other controllers can listen to.
jQuery(event.target).trigger('viewsreference-select');
// Return false to tell jQuery UI that we've filled in the value already.
return false;
}

Drupal.behaviors.displayMessage = {
attach: function (context, settings) {
$(document).ajaxComplete(function (event, request, settings) {
$('.field--type-viewsreference select.viewsreference-display-id', context).each(function () {
$('.viewsreference-display-error', context).remove();
var $parent = $(this).parent().hide();
if ($(this).find('option').length <= 1) {
var $error = $('

There is no display available. Please select another view or change the field settings.

');
$parent.after($error);
}
else {
$parent.show();
}
});
});
}
};

})(jQuery, drupalSettings);
```

Proposed resolution

```
})(jQuery);
```

CommentFileSizeAuthor
#2 3291432-2.patch352 bytesadil_siddiqui
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fnalb2 created an issue. See original summary.

adil_siddiqui’s picture

Status: Active » Needs review
StatusFileSize
new352 bytes

Patch created

fnalb2’s picture

Status: Needs review » Reviewed & tested by the community

urvashi_vora made their first commit to this issue’s fork.

seanb’s picture

+++ b/js/viewsreference.js
@@ -2,7 +2,7 @@
+(function ($, Drupal, drupalSettings) {

@@ -52,4 +52,4 @@
+})(jQuery, Drupal, drupalSettings);

drupalSettings is not actually being used so I think we can remove it.

  • seanB authored b393e550 on 8.x-2.x
    Issue #3291432 by Adil_Siddiqui, seanB: viewsreference.js The function...
seanb’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.