Module Description
Provides a multi-value form element that wraps any number of form elements. The wrapped elements will be repeated based on the cardinality specified on the wrapper. It basically brings the delta cardinality concept of fields to form elements. Each set of child elements ("delta") can be re-ordered with drag-and-drop.
$form['contacts'] = [ '#type' => 'multivalue', '#title' => $this->t('Contacts'), '#cardinality' => MultiValue::CARDINALITY_UNLIMITED, 'name' => [ '#type' => 'textfield', '#title' => $this->t('Name'), ], 'mail' => [ '#type' => 'email', '#title' => $this->t('E-mail'), ], ];
$form['contacts'] = [ '#type' => 'multivalue', '#title' => $this->t('Contacts'), '#cardinality' => MultiValue::CARDINALITY_UNLIMITED, 'name' => [ '#type' => 'textfield', '#title' => $this->t('Name'), ], 'mail' => [ '#type' => 'email', '#title' => $this->t('E-mail'), ], ];
Module Link
Project Usage
1512
Security Covered
Not Covered By Security Advisory
Version Available
Production
Module Summary
This module solves the problem of creating a multi-value form element that wraps any number of form elements and allows for re-ordering with drag-and-drop functionality.
Data Name
multivalue_form_element