Problem/Motivation

For custom fields with cardinality > 1, we have the option/button to "Add another item". It would be great if we could easily customize this "item" label (e.g. Add another building, add another location, add another member, add another relationship etc.)

I know we have hook_form_alter but having an easy-to-use setting in the Manage form fields would be super helpful. Often an "item" doesn't encompass the correct meaning e.g. when referring to a person. This feature would really enhance the customized feel for the module.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

chrisck created an issue. See original summary.

apmsooner’s picture

It really should be a CORE thing... but I can do it pretty easily as I assume it could probably take a long time to get reviewed. I'll put together a patch you can test out.

apmsooner’s picture

Status: Active » Needs review

Try the patch. There will be a new field in the field settings form.

chrisck’s picture

Thanks @apmsooner! I’ll test and review as soon as I’m able. That was quick work :)

apmsooner’s picture

I'm gonna be putting out a new release soon so if you want this feature in, please review sooner than later. If there's any form field mods you want like label, description, etc... just let me know as they are easy alterations. Thanks

chrisck’s picture

I've tested the MR and I can see the new settings field Add another button label in the field settings. However, after inputting a string and saving the form, the field is cleared. On the node form, the button still shows as "Add another item". Tried clearing cache too.

apmsooner’s picture

Try the updated patch please. I forgot to add it to the default settings.

chrisck’s picture

It is working as expected now. Thank you.

apmsooner’s picture

Status: Needs review » Fixed

Merged!

  • apmsooner committed dd6a9812 on 3.1.x
    Issue #3508552 by apmsooner, chrisck: Customize item label for "Add...
apmsooner’s picture

Status: Fixed » Closed (fixed)