Proposed resolution

One option is to add a parameter or a constant value of an action class instance ($pass_rows) and check if it equals TRUE.

Second option is to create a new plugin type for Views Bulk Operations action that would extend Drupal\Core\Action\ConfigurableActionBase and create additional annotation for this setting.

For now I'd use the first solution, as it'd be much simplier and wouldn't cause the need to create a new plugin type, all would be in core Action plugin and only one plugin manager service (core plugin.manager.action) would have to be injected to ViewsBulkOperationsBulkForm and ViewsBulkOperationsActionProcessor

Just a thought: Can a plugin manager get plugins of 2 different types? That'd make things much easier..

Comments

Graber created an issue. See original summary.

  • Graber committed efaf38b on 8.x-1.x
    Issue #2884847: Added passing of the view with results to action object...
graber’s picture

Status: Active » Needs review

Now VBO action has an additional annotation:
pass_view - if set to TRUE, the entire view object will be available as the action parameter and selected results can be accessed at $view->result (check README.txt and example module).

TODO: multilanguage support.

  • Graber committed ceb5e70 on 8.x-1.x
    Issue #2884847: Added translation support when populating views results...
graber’s picture

Assigned: graber » Unassigned
graber’s picture

Status: Needs review » Fixed

No feedback for over 1 month and works as planned on all my environments, setting status to "fixed".

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

mpp’s picture

pass_view does not seem to support passing custom parameters like the current node ID used in an argument.

graber’s picture

@mpp, does the problem still occur? If so, can you create a separate issue?

Generally when the view is rebuilt from the action processor, parameters are applied to it and also saved in the action $context parameter.