Add selected entities as references of a newly created entity

Created on 2 June 2023, over 1 year ago

Problem/Motivation

I'm looking for a solution to add the rows (entities) selected via VBO as referenced entities to a new entity which is created on submitting the VBO form.

In more human terms: I would like to create a custom product type on the fly within Drupal Commerce. During the creation process the user can select which options that newly created custom product will contain. (Think of a receipt with a selectable list of ingredients, or a menu with a selectable list of dishes). On submitting the form, a new custom Product is created, with the selected components (products) added to the newly created product.

Steps to reproduce

I have a table with selectable rows. On submitting the form, I would like to:

  1. Create a new entity, which has a field_entity_reference multivalue field.
  2. Add all the selected rows (entities) to the field_entity_reference of the new entity

Remaining tasks

I see that there is a VBO: (Confirm) Form submit of views bulk operations, to which a Create new entity task can be connected. But I do not know how to proceed from here.

💬 Support request
Status

Active

Version

1.0

Component

Documentation

Created by

🇮🇪Ireland marksmith

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

Comments & Activities

Production build 0.71.5 2024