diff --git a/composer.json b/composer.json index cc1ddc489fc68c8f9bca0cd22bb72990ba1ff755..1527bdbb9a90e0ca0a582109aa18a60500cddea2 100644 --- a/composer.json +++ b/composer.json @@ -174,7 +174,7 @@ "drupal/views_bootstrap": "3.6", "drupal/views_bulk_operations": "3.13", "drupal/views_fieldsets": "^3.4", - "drupal/views_infinite_scroll": "1.8", + "drupal/views_infinite_scroll": "1.9", "drupal/webform": "^6", "drush-ops/behat-drush-endpoint": "0.0.5", "drush/drush": "10.3.6", diff --git a/composer.lock b/composer.lock index c1ff2ef03cfdc7ad073399844c2da1be88288c52..827f5cde1631d026b70618a3f4ea60ed417e9cf1 100644 --- a/composer.lock +++ b/composer.lock @@ -7924,17 +7924,17 @@ }, { "name": "drupal/views_infinite_scroll", - "version": "1.8.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/views_infinite_scroll.git", - "reference": "8.x-1.8" + "reference": "8.x-1.9" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/views_infinite_scroll-8.x-1.8.zip", - "reference": "8.x-1.8", - "shasum": "b9fceb24184792fb81c4e2ff1bf7f18fd8e50674" + "url": "https://ftp.drupal.org/files/projects/views_infinite_scroll-8.x-1.9.zip", + "reference": "8.x-1.9", + "shasum": "875d58d317d48036ed1d9ef538bc8a76bc3dcb5b" }, "require": { "drupal/core": "^8.8 || ^9" @@ -7942,8 +7942,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.8", - "datestamp": "1615218916", + "version": "8.x-1.9", + "datestamp": "1632421809", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 995e09bc4b2dae59649355731041a454824a55e8..a9f9416c4bd90b4ffe8de5a0877f5c7f3f32e249 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -8256,18 +8256,18 @@ }, { "name": "drupal/views_infinite_scroll", - "version": "1.8.0", - "version_normalized": "1.8.0.0", + "version": "1.9.0", + "version_normalized": "1.9.0.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/views_infinite_scroll.git", - "reference": "8.x-1.8" + "reference": "8.x-1.9" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/views_infinite_scroll-8.x-1.8.zip", - "reference": "8.x-1.8", - "shasum": "b9fceb24184792fb81c4e2ff1bf7f18fd8e50674" + "url": "https://ftp.drupal.org/files/projects/views_infinite_scroll-8.x-1.9.zip", + "reference": "8.x-1.9", + "shasum": "875d58d317d48036ed1d9ef538bc8a76bc3dcb5b" }, "require": { "drupal/core": "^8.8 || ^9" @@ -8275,8 +8275,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.8", - "datestamp": "1614959012", + "version": "8.x-1.9", + "datestamp": "1632421809", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 18da0c6a53a660c045d1e0c4e2aaa9126c991964..489758cff599e928c1545360fd6c4cc57fb22ed7 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1823,12 +1823,12 @@ 'dev_requirement' => false, ), 'drupal/views_infinite_scroll' => array( - 'pretty_version' => '1.8.0', - 'version' => '1.8.0.0', + 'pretty_version' => '1.9.0', + 'version' => '1.9.0.0', 'type' => 'drupal-module', 'install_path' => __DIR__ . '/../../web/modules/views_infinite_scroll', 'aliases' => array(), - 'reference' => '8.x-1.8', + 'reference' => '8.x-1.9', 'dev_requirement' => false, ), 'drupal/views_ui' => array( diff --git a/web/modules/views_infinite_scroll/js/infinite-scroll.js b/web/modules/views_infinite_scroll/js/infinite-scroll.js index 0a66527542e38553c7a72dd1537f5058e899278b..48abbcb92792d653c7b5216c27976fe2cf6d0c97 100644 --- a/web/modules/views_infinite_scroll/js/infinite-scroll.js +++ b/web/modules/views_infinite_scroll/js/infinite-scroll.js @@ -33,6 +33,11 @@ $.fn.infiniteScrollInsertView = function ($newView) { // Extract the view DOM ID from the view classes. var matches = /(js-view-dom-id-\w+)/.exec(this.attr('class')); + + if (!matches) { + return; + } + var currentViewId = matches[1].replace('js-view-dom-id-', 'views_dom_id:'); // Get the existing ajaxViews object. @@ -104,4 +109,19 @@ } }; + /** + * Views AJAX pagination filter. + * + * In case the Entity View Attachment is rendered in a view context, + * the default filter function prevents the required 'Use AJAX' setting + * to work. + * + * @return {Boolean} + * Whether to apply the Views AJAX paginator. VIS requires this setting + * for pagination. + */ + Drupal.views.ajaxView.prototype.filterNestedViews = function () { + return this.$view.hasClass('view-eva') || !this.$view.parents('.view').length; + }; + })(jQuery, Drupal, Drupal.debounce); diff --git a/web/modules/views_infinite_scroll/src/EventSubscriber/AjaxResponseSubscriber.php b/web/modules/views_infinite_scroll/src/EventSubscriber/AjaxResponseSubscriber.php index 040410ebe18c4ad035ec36bf5387fb9c8a6a76b9..4cd796982522e376983cac223df65147afac5658 100644 --- a/web/modules/views_infinite_scroll/src/EventSubscriber/AjaxResponseSubscriber.php +++ b/web/modules/views_infinite_scroll/src/EventSubscriber/AjaxResponseSubscriber.php @@ -49,7 +49,10 @@ public function onResponse(FilterResponseEvent $event) { $view = $response->getView(); // Only alter commands if the user has selected our pager and it attempting // to move beyond page 0. - if ($view->getPager()->getPluginId() !== 'infinite_scroll' || $event->getRequest()->query->get('page') == 0) { + if ($view->getPager()->getPluginId() !== 'infinite_scroll' || + $view->getCurrentPage() === 0 || + $view->getPager()->getCurrentPage() === 0 + ) { // When the current page is 0 it might be the case that there where no // additional items in this case we want to still append the empty result. return; diff --git a/web/modules/views_infinite_scroll/views_infinite_scroll.info.yml b/web/modules/views_infinite_scroll/views_infinite_scroll.info.yml index 6e8c4a2cb9b5b6195793f8cbbbbd02f634a9af8f..7ca3ca3bef1d6617cabac540c141aaf9ae6faa70 100644 --- a/web/modules/views_infinite_scroll/views_infinite_scroll.info.yml +++ b/web/modules/views_infinite_scroll/views_infinite_scroll.info.yml @@ -7,7 +7,7 @@ core_version_requirement: ^8.8 || ^9 dependencies: - drupal:views -# Information added by Drupal.org packaging script on 2021-03-05 -version: '8.x-1.8' +# Information added by Drupal.org packaging script on 2021-09-23 +version: '8.x-1.9' project: 'views_infinite_scroll' -datestamp: 1614959014 +datestamp: 1632421789 diff --git a/web/modules/views_infinite_scroll/views_infinite_scroll.module b/web/modules/views_infinite_scroll/views_infinite_scroll.module index 38b35375b2e7c18132a072cb87529512eeb17cf5..1362c17e5f47ae402be5564748c7b05f1c5bfc73 100644 --- a/web/modules/views_infinite_scroll/views_infinite_scroll.module +++ b/web/modules/views_infinite_scroll/views_infinite_scroll.module @@ -52,3 +52,12 @@ function views_infinite_scroll_preprocess_views_view(&$vars) { } } } + +/** + * Implements hook_preprocess_eva_display_entity_view() + */ +function views_infinite_scroll_preprocess_eva_display_entity_view(&$vars) { + // When the contributed EVA module is used to display the View, apply the + // preprocessing logic of this module. + views_infinite_scroll_preprocess_views_view($vars); +}