Loading facets.install +1 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,7 @@ function facets_update_8005() { function facets_update_8006() { $query = \Drupal::entityQuery('block') ->condition('plugin', 'facet_block', 'STARTS_WITH') ->accessCheck() ->execute(); foreach ($query as $block_id) { Loading facets.libraries.yml +3 −3 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -28,7 +28,7 @@ widget: dependencies: - core/jquery - core/drupal - core/jquery.once - core/once drupal.facets.link-widget: version: VERSION Loading Loading @@ -69,7 +69,7 @@ soft-limit: js/soft-limit.js: {} dependencies: - core/jquery - core/jquery.once - core/once - core/drupal - core/drupalSettings Loading js/base-widget.js +5 −8 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ * Provides base widget behaviours. */ (function ($, Drupal) { (function ($, Drupal, once) { 'use strict'; Loading @@ -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() ]); Loading @@ -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); Loading @@ -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'); Loading @@ -57,4 +54,4 @@ } }; })(jQuery, Drupal); })(jQuery, Drupal, once); js/checkbox-widget.js +3 −4 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ * Transforms links into checkboxes. */ (function ($, Drupal) { (function ($, Drupal, once) { 'use strict'; Loading Loading @@ -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', context) .once('facets-checkbox-transform'); var $checkboxWidgets = $(once('facets-checkbox-transform', '.js-facets-checkbox-links', context)); if ($checkboxWidgets.length > 0) { $checkboxWidgets.each(function (index, widget) { Loading Loading @@ -126,4 +125,4 @@ e.preventDefault(); }; })(jQuery, Drupal); })(jQuery, Drupal, once); js/dropdown-widget.js +3 −3 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ * Transforms links into a dropdown list. */ (function ($) { (function ($, once) { 'use strict'; Loading @@ -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>'); Loading Loading @@ -101,4 +101,4 @@ }); }; })(jQuery); })(jQuery, once); Loading
facets.install +1 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,7 @@ function facets_update_8005() { function facets_update_8006() { $query = \Drupal::entityQuery('block') ->condition('plugin', 'facet_block', 'STARTS_WITH') ->accessCheck() ->execute(); foreach ($query as $block_id) { Loading
facets.libraries.yml +3 −3 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -28,7 +28,7 @@ widget: dependencies: - core/jquery - core/drupal - core/jquery.once - core/once drupal.facets.link-widget: version: VERSION Loading Loading @@ -69,7 +69,7 @@ soft-limit: js/soft-limit.js: {} dependencies: - core/jquery - core/jquery.once - core/once - core/drupal - core/drupalSettings Loading
js/base-widget.js +5 −8 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ * Provides base widget behaviours. */ (function ($, Drupal) { (function ($, Drupal, once) { 'use strict'; Loading @@ -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() ]); Loading @@ -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); Loading @@ -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'); Loading @@ -57,4 +54,4 @@ } }; })(jQuery, Drupal); })(jQuery, Drupal, once);
js/checkbox-widget.js +3 −4 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ * Transforms links into checkboxes. */ (function ($, Drupal) { (function ($, Drupal, once) { 'use strict'; Loading Loading @@ -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', context) .once('facets-checkbox-transform'); var $checkboxWidgets = $(once('facets-checkbox-transform', '.js-facets-checkbox-links', context)); if ($checkboxWidgets.length > 0) { $checkboxWidgets.each(function (index, widget) { Loading Loading @@ -126,4 +125,4 @@ e.preventDefault(); }; })(jQuery, Drupal); })(jQuery, Drupal, once);
js/dropdown-widget.js +3 −3 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ * Transforms links into a dropdown list. */ (function ($) { (function ($, once) { 'use strict'; Loading @@ -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>'); Loading Loading @@ -101,4 +101,4 @@ }); }; })(jQuery); })(jQuery, once);