Hi everyone,

I'm working on a view block in which I load several nodes.
I don't know how many nodes will be loaded because it depends on an exposed filter.
I have twig file for the display, I also have a twigExtension php file to call custom functions.

For example, the output of my view looks like this :

Reference
ABCD
BCDE
CDEF

I would like to get a form :

Reference | Quantity (Select dropdown)
ABCD | 0
BCDE | 1
CDEF | 0

Once the user clicks on the Submit Button, it creates 3 nodes of a Custom Content Type.

The lead I'm investigating for now is to use a form but I don't know how I could pass the results to this form, build it with these results and get something like :

public function buildForm(array $form, FormStateInterface $form_state) {
	$form['ref_1'] = array(
		'#type' => 'textfield',
		'#title' => t('Reference 1'),
		'#default_value' => 'ABCD'
		'#attributes' => array('readonly' => 'readonly')
	);
	$form['quantity_1'] = array(
		'#type' => 'select',
		'#title' => t('Quantity 1'),
		'#options' => array('00', '01', '02', '03'),
	);

	$form['ref_2'] = array(
		'#type' => 'textfield',
		'#title' => t('Reference 2'),
		'#default_value' => 'BCDE'
		'#attributes' => array('readonly' => 'readonly')
	);
	$form['quantity_2'] = array(
		'#type' => 'select',
		'#title' => t('Quantity 2'),
		'#options' => array('00', '01', '02', '03'),
	);

	$form['ref_3'] = array(
		'#type' => 'textfield',
		'#title' => t('Reference 3'),
		'#default_value' => 'CDEF'
		'#attributes' => array('readonly' => 'readonly')
	);
	$form['quantity_3'] = array(
		'#type' => 'select',
		'#title' => t('Quantity 3'),
		'#options' => array('00', '01', '02', '03'),
	);

	$form['submit'] = array(
		'#type' => 'submit',
		'#value' => t('Submit'),
	);

	return $form;
}

Or maybe should I look at the exposed filter function, maybe is there a way to modify the way it works to call my own function before display ?

How would you do it ?

Thanks.