Way to pass URL query params with VBO action?

Created on 18 July 2019, over 5 years ago
Updated 13 February 2024, 9 months ago

I've got an issue that's part Views Bulk Operations, part Facets, and part Views Bulk Edit. I recognize this isn't entirely a VBO issue, but it's not entirely VBE or Facets either. I'm going to try to ask the VBO specific part of my question here.

When a VBO form is submitted, there's a form redirect to /views-bulk-operations/configure/[search_id]/[page_id]

Is there a way (hook_form_alter, etc) to alter this redirect so that URL query parameters on the view (in my case, search facets) can be added to the URL Redirect so that the page instead redirects to:

/views-bulk-operations/configure/[search_id]/[page_id]?myparam1=A&myparam2=B

Much more detail here #3068802: Search Facets ignored with VBO "Select All" β†’ . In short, Facets, VBO and VBE don't play nicely when a Faceted Filtered Search has "Select All" and then a Views Bulk Edit command is run. The facets are forgotten because the query parameters are discarded on VBO's preconfig page.

Thanks in advance!

πŸ’¬ Support request
Status

Active

Version

3.2

Component

Core

Created by

πŸ‡¨πŸ‡¦Canada TrevorBradley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States mmlmitchell Spokane, WA

    While I see this issue is 4 years old, I have the same issue with VBO 4.2.5.

    I need to pass the value of the "contextual filter" from the View (which in my case is a Group ID) through to the VBO action form as a URL parameter (i.e. "group=[value]").

    The current URL that redirects to the "confirgure" page is this:
    /views-bulk-operations/configure/[search_id]/[page_id]

    What I need is this:
    /views-bulk-operations/configure/[search_id]/[page_id]?group=[value]

    Note, "group" is the name of the parameter, "[value]" is the Group ID from the contextual filter.

    I've tried to use Trevor's solution in a custom module, but it's not working. I think the three things need to happen:

    1. Get the value from the contextual filter on the View,
    2. Create the parameter with value, and
    3. Amend the redirect URL with the parameter

    Any hints, suggestions, and idea would be appreciated.

    Thanks!

  • πŸ‡΅πŸ‡±Poland Graber

    Why do you need to pass that contextual filter explicitly as an URL parameter? You have contextual filter values in the VBO tempstore data.. That's also where any other values could go. Check output of $this->getFormData($view_id, $display_id); in your form builder that extends Drupal\views_bulk_operations\Form\ConfigureAction or uses Drupal\views_bulk_operations\Form\ViewsBulkOperationsFormTrait.

  • πŸ‡«πŸ‡·France damien laguerre

    I encounter a similar issue with a view facets filter.

    Everything works fine, except if I want to apply the action to all result pages.
    The facets module does not identify which facets filters are active on the batch route.

    I found a (quick and maybe dirty) solution by passing the "f" parameter to the query.

Production build 0.71.5 2024