Problem/Motivation
If cardinality of a field is set as 'n', the entity create/edit forms will render the field widget 'n' number of times. It would be nice to render only one widget, and provide an 'Add another item' button to add more field values in such cases, to match the unlimited cardinality behavior.
Steps to reproduce
- Install Drupal with the standard profile
- Add a text field to the article content type. Set the cardinality to 4 (limited)
- Try to create an article content. The text field widget will be rendered 4 times.
Proposed resolution
- Provide an option to render only one widget in form, in the 'Manage form display' settings of the field (Current name: Show add more button)
- If this option is selected, only one widget will be rendered in the form along with an 'Add another item' button to add the remaining ones.
Remaining tasks
- Create a merge request
- Add tests
- Review
- Commit
User interface changes
A new checkbox 'Show add more button' in the widget settings of fields with limited cardinality (>1) that provides 'Add another item' button instead of rendering the maximum number of widgets.
Introduced terminology
None
API changes
None
Data model changes
None
Release notes snippet
N/A