Closed (fixed)
Project:
Views Bulk Operations (VBO)
Version:
8.x-1.x-dev
Component:
Core
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Oct 2017 at 10:57 UTC
Updated:
21 Aug 2018 at 07:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
leon kessler commentedI've had a look into this, and the issue comes from here:
Plugin/views/field/ViewsBulkOperationsBulkForm.php line 625:
$data['redirect_uri'] = $this->getDestinationArray();The destination parameter is used later in ViewsBulkOperationsController.php line 48:
return batch_process($view_data['redirect_uri']['destination']);So at this point, using the example above, the destination parameter will be
/uk/admin/content.The issue is that this get's passed into
batch_process(), which eventually attempts to convert it into a Url object. Because it's not a valid path, it switches it to the current one (which is /batch). See: http://cgit.drupalcode.org/drupal/tree/core/includes/batch.inc?id=e5713b...Comment #3
leon kessler commentedHave fixed this by getting the url object directly from the View. Not sure why this wasn't done in the first place - perhaps for if there was already a destination on the request?
I do think that this module's current use of
getDestinationArray()is not correct. As per the documentation: Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. which this module is not doing (it's extracting the destination and using that data by itself).Comment #5
leon kessler commentedWhoops, small typo in last patch (which lead to php error and failed tests).
New patch attached...
Comment #6
graber commentedLooks ok, but we don't have to use the
$this->getView()method inside the view field plugin, as view object is available internally. Changed to$this->view.Comment #7
graber commentedA view containing VBO field can be in a block. In such a case the
$this->view->getUrl()method throws:InvalidArgumentException: You cannot create a URL to a display without routes.
We need to get the URL in a different way.
Comment #8
graber commentedOk, here's a solution that also works in block views.
Comment #10
graber commentedComment #12
gonzalo2683 commentedI do not know if it's the place to consult, @Graber, a question, is there a way that once the custom action ends up redirecting to a different URL than the default one?
Comment #13
graber commentedHi @Gonzalo,
Check
\Drupal\views_bulk_operations\Form\ViewsBulkOperationsFormTrait::getTempstoreData(). You need to replaceredirect_urlparameter at some point (best when action execution is finished).