Skip to content

Commit

Permalink
Merge pull request #198 from esmero/ISSUE-197
Browse files Browse the repository at this point in the history
ISSUE-197: Deals with moving target for our VBO Event subscriber conditionals
  • Loading branch information
DiegoPino authored May 7, 2024
2 parents 88899a7 + 473aa3e commit c3e7be6
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,21 @@ public function updateFacetCache(ViewsBulkOperationsEvent $event) {
$exposed_input = $event->getView()->getExposedInput();
$tempStoreName = 'ami_vbo_batch_facets_' . md5($event->getView()->id() . '_' . $event->getView()->current_display);
// Do not override once the batch starts.
// Maybe delete when on view.solr_search_content_with_find_and_replace.page_1?
// We do not know here if facets will or not be in a f[] so we pass
// all. The processor will know/read from the URL Processor settings.
// Do not overridewrite once the batch starts. Arguments will be 'op', format, id
if (!isset($exposed_input['op'])) {
// all values (also good, respects filters).
// The VBO URL facet processor will know/read from the URL Processor settings.
// Do not overridewrite once the batch starts or we will end with 0 filters.
// Arguments will be 'op' = 'do', _format = 'json', id = a number the batch id
// Normally just checking if this is happening under the unbrella of the actual Views Route is enough
// BUT ... we need to also take in account layout builder .. so in that case we check for 'op' !== do && id (the batch)
// @TODO. No idea how to deal with the blocks and other options
// I could to the opposite> Save it anytime it is not a batch but bc Facets are basically processed all the time
// anywhere that would be a lot of extra processing time.
if ((\Drupal::routeMatch()->getRouteName() == 'view'. '.' . $event->getView()->id(). '.' .$event->getView()->current_display) ||
(
(\Drupal::routeMatch()->getRouteObject()->getOption('_layout_builder') ||
$event->getView()->display_handler->getBaseId() == 'block') && (($exposed_input['op'] ?? NULL) !== "do") && !isset($exposed_input['id']))
) {
$this->tempStoreFactory->get($tempStoreName)->set(
$this->currentUser->id(), $exposed_input ?? []
);
Expand Down

0 comments on commit c3e7be6

Please sign in to comment.