Missing checkboxes in 4.2.6 when using Views Data Export

Created on 20 February 2024, 4 months ago
Updated 25 April 2024, 2 months ago

Problem/Motivation

Something in between 4.2.5 and 4.2.6 is causing the checkboxes in my `commerce_product_variation` view to go missing. There is no ability to select each row, but there are options at the bottom of the view to select all rows. Reverting to 4.2.5 fixes the issue.

I'm investigating which commit causes the issue for me and to confirm it it's not a project specific bug, but wanted to get the issue open in case others are experiencing this.

Steps to reproduce

Create a view with VBO view (mine was commerce_product_variation)

Get checkboxes...

Add a Views Data Export display and attach it to the VBO parent view in the "Path settings" for the export display

No checkboxes...

πŸ› Bug report
Status

Needs work

Version

4.2

Component

Core

Created by

πŸ‡ΊπŸ‡ΈUnited States andyg5000 North Carolina, USA

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

Merge Requests

Comments & Activities

  • Issue created by @andyg5000
  • πŸ‡ΊπŸ‡ΈUnited States andyg5000 North Carolina, USA

    The issue appears after applying the commit form πŸ“Œ Create API for view provider modules to provide entity labels and bulk form keys Fixed

  • πŸ‡ΊπŸ‡ΈUnited States andyg5000 North Carolina, USA

    In my instance $this->view->result in https://git.drupalcode.org/project/views_bulk_operations/-/blob/4.2.x/sr... is null unless I add $this->view->execute(); right before it.

    Not sure if that's the best solution, but will work up a patch once I have something to share.

  • πŸ‡ΊπŸ‡ΈUnited States andyg5000 North Carolina, USA

    It looks like attaching a Views Data Export display to the same view as the VBO is causing this. Not sure which module should be responsible for fixing it, but it seems like it's probably VBO's responsibility. Here's what's happening:

    Somewhere between `ViewsBulkOperationsBulkForm` and `ViewsBulkOperationsViewData` the object expected as $this->view is losing it's reference to being the same object.

    ViewsBulkOperationsBulkForm calls :

    <?php 
        $action_options = $this->getBulkOptions();
        if (!empty($this->view->result) && !empty($action_options)) {
    
          // Get bulk form keys and entity labels for all rows.
          $entity_data = $this->viewData->getViewEntityData();
    ...
    

    And in `ViewsBulkOperationsViewData`, the $this->view->result is null event though checked !empty above

    $base_field = $this->view->storage->get('base_field');
        foreach ($this->view->result as $row_index => $row) {
    

    If I remove the data export as an attachment to the VBO view, the issue goes away.

  • πŸ‡ΊπŸ‡ΈUnited States andyg5000 North Carolina, USA
  • Status changed to Needs review 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States andyg5000 North Carolina, USA

    I was able to fix this by aborting the init when the view display is a data export. It seems like you wouldn't ever have VBO as part of a data export anyway. I'm not sure this is the best approach, but it does fix this issue and I can still export the data.

    If you didn't want to go this route, I believe you will need to split $this->viewData into an array of views data instances based on the view display. Or maybe even not use the service container for that since it's the same object that's reused across multiple views displays being loaded in a single request.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.x + Environment: PHP 8.2 & MySQL 8
    last update 4 months ago
    15 pass
  • Pipeline finished with Success
    4 months ago
    Total: 179s
    #99802
  • Status changed to Needs work 4 months ago
  • πŸ‡΅πŸ‡±Poland Graber

    Unfortunately we cannot accommodate every module that breaks VBO like this, we need a generic solution if it exists.
    Setting this to β€œneeds work” for now, maybe the diff will be useful for someone that needs this fixed urgently.

    Thanks!

  • πŸ‡ΊπŸ‡¦Ukraine marchuk.vitaliy Rivne, UA

    I can also confirm that this issue appears in 4.2.6, but I don't see it in 4.2.5.
    The fix from MR fixes this, not sure if this fix is ​"good" but can be used as a temporary solution.

  • πŸ‡¬πŸ‡§United Kingdom sadikyalcin

    Removing the VBO field from the data export view fixes the issue.

  • πŸ‡΅πŸ‡±Poland Graber

    Maybe you can consider using https://www.drupal.org/project/vbo_export β†’ on the view instead?

  • πŸ‡·πŸ‡ΈSerbia vaish

    I run into this issue after the upgrade to 4.2.6. Solution suggested in comment #10 worked for me. VBO field doesn't serve any purpose in the "data export" display.

Production build 0.69.0 2024