Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295466

Fixed maximum number of field values, but use «add more» similar to when cardinality «unlimited» is used

$
0
0

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.


/files/issues/2024-08-13/Add%20another%20item%20btn.png

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


Viewing all articles
Browse latest Browse all 295466


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>