Commit 747da6ed authored by Markus Kalkbrenner's avatar Markus Kalkbrenner Committed by Markus Kalkbrenner
Browse files

Issue #3297168 by mkalkbrenner, balintpekker: Automated Drupal 10 compatibility fixes

parent d3cf8003
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ drupal.facets.index-active-formatters:
  dependencies:
    - core/jquery
    - core/drupal
    - core/jquery.once
    - core/once

drupal.facets.edit-facet:
  version: VERSION
@@ -28,7 +28,7 @@ widget:
  dependencies:
    - core/jquery
    - core/drupal
    - core/jquery.once
    - core/once

drupal.facets.checkbox-widget:
  version: VERSION
@@ -65,6 +65,6 @@ soft-limit:
    js/soft-limit.js: {}
  dependencies:
    - core/jquery
    - core/jquery.once
    - core/once
    - core/drupal
    - core/drupalSettings
+5 −8
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * Provides base widget behaviours.
 */

(function ($, Drupal) {
(function ($, Drupal, once) {

  'use strict';

@@ -20,8 +20,7 @@
   *   filter is executed.
   *
   * This is an example how to trigger "facets_filter" event for your widget:
   *   $('.my-custom-widget.js-facets-widget')
   *     .once('my-custom-widget-on-change')
   *   $(once('my-custom-widget-on-change', '.my-custom-widget.js-facets-widget'))
   *     .on('change', function () {
   *       // In this example $(this).val() will provide needed URL.
   *       $(this).trigger('facets_filter', [ $(this).val(), false ]);
@@ -34,8 +33,7 @@
   * event before initial filter request is finished.
   *
   * This is an example how to handle "facets_filtering":
   *   $('.my-custom-widget.js-facets-widget')
   *     .once('my-custom-widget-on-facets-filtering')
   *   $(once('my-custom-widget-on-facets-filtering', '.my-custom-widget.js-facets-widget'))
   *     .on('facets_filtering.my_widget_module', function () {
   *       // Let's say, that widget can be simply disabled (fe. select).
   *       $(this).prop('disabled', true);
@@ -47,8 +45,7 @@
   */
  Drupal.behaviors.facetsFilter = {
    attach: function (context) {
      $('.js-facets-widget', context)
        .once('js-facet-filter')
      $(once('js-facet-filter', '.js-facets-widget', context))
        .on('facets_filter.facets', function (event, url) {
          $('.js-facets-widget').trigger('facets_filtering');

@@ -57,4 +54,4 @@
    }
  };

})(jQuery, Drupal);
})(jQuery, Drupal, once);
+3 −4
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * Transforms links into checkboxes.
 */

(function ($, Drupal) {
(function ($, Drupal, once) {

  'use strict';

@@ -32,8 +32,7 @@
   */
  Drupal.facets.makeCheckboxes = function (context) {
    // Find all checkbox facet links and give them a checkbox.
    var $checkboxWidgets = $('.js-facets-checkbox-links, .js-facets-links', context)
      .once('facets-checkbox-transform');
    var $checkboxWidgets = $(once('.js-facets-checkbox-links, .js-facets-links', context));

    if ($checkboxWidgets.length > 0) {
      $checkboxWidgets.each(function (index, widget) {
@@ -150,4 +149,4 @@
    e.preventDefault();
  };

})(jQuery, Drupal);
})(jQuery, Drupal, once);
+3 −3
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * Transforms links into a dropdown list.
 */

(function ($) {
(function ($, once) {

  'use strict';

@@ -24,7 +24,7 @@
   */
  Drupal.facets.makeDropdown = function (context, settings) {
    // Find all dropdown facet links and turn them into an option.
    $('.js-facets-dropdown-links').once('facets-dropdown-transform').each(function () {
    $(once('facets-dropdown-transform', '.js-facets-dropdown-links')).each(function () {
      var $ul = $(this);
      var $links = $ul.find('.facet-item a');
      var $dropdown = $('<select></select>');
@@ -106,4 +106,4 @@
    });
  };

})(jQuery);
})(jQuery, once);
+5 −5
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 * Provides the soft limit functionality.
 */

(function ($) {
(function ($, once) {

  'use strict';

@@ -43,13 +43,13 @@

    // Hide facets over the limit.
    facetsList.each(function () {
      $(this).children('li:gt(' + zero_based_limit + ')').once('applysoftlimit').hide();
      $(once('applysoftlimit', $(this).children('li:gt(' + zero_based_limit + ')'))).hide();
    });

    // Add "Show more" / "Show less" links.
    facetsList.once().filter(function () {
    $(once('applysoftlimit', facetsList.filter(function () {
      return $(this).find('li').length > limit;
    }).each(function () {
    }))).each(function () {
      var facet = $(this);
      var showLessLabel = settings.facets.softLimitSettings[facet_id].showLessLabel;
      var showMoreLabel = settings.facets.softLimitSettings[facet_id].showMoreLabel;
@@ -70,4 +70,4 @@
    });
  };

})(jQuery);
})(jQuery, once);
Loading