I have a view of nodes. I'd like to be able to select rows (thinking VBO is the best) and pass those selected nodes to a form (specifically /node/add/payments) to pre-populate entity references.

Any thoughts on how to do this? I've been playing around with several options and can't figure it out.


At a high level, you could do something like this with a custom module:

  • Create a custom VBO action (see docs) to take action on your selected nodes.
  • Have your custom VBO action redirect to /node/add/payments with some query parameter that encodes your selected nodes (e.g. /node/add/payments?my_nids=1,2,3).
  • Add hook_form_alter() invocation in your module to read this query parameter (e.g. $nids = explode(',', \Drupal::request()->request->get('my_nids')) and pre-populate the entity ref field with your values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.