Support from Acquia helps fund testing for Drupal Acquia logo

Comments

v.pathak created an issue. See original summary.

icf-vpathak’s picture

Hi,

I used this module on Drupal 7 and I know that we could change the label/title of the Other option. I add this module on Drupal 8 and I was not able to see those options where we could update the label of 'Other'. Can anyone please help me with this?

Also, thanks for such a cool module :)

icf-vpathak’s picture

Version: 6.x-1.x-dev » 8.x-1.x-dev
daggerhart’s picture

This patch provides a widget setting for changing the Other option label. If no label is set, it defaults back to "Other". Patch is against -dev branch

Tsymi’s picture

Patch proposed by daggerhart in #4 worked for me thanks !

nkoporec’s picture

Status: Active » Reviewed & tested by the community

Tested the patch and it works great.It adds the ability to change Other text.Great work!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 4: other-option-label-2894033-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

francoud’s picture

Will this patch ever commited to *dev version at least?

legolasbo’s picture

Yes @francoud,

When it reaches Reviewed & tested by the community status

cgoffin’s picture

I adjusted the patch to make the other option text and the other option field label configurable (as in D7).

Sutharsan’s picture

The labels should be translatable too. That requires a schema definition.
Docs: https://www.drupal.org/docs/8/api/configuration-api/configuration-schema...

douggreen’s picture

Status: Needs work » Reviewed & tested by the community

IMO this works well enough to commit, and the translation of the new labels could be a follow-up issue, so I'm marking it as RTBC.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: select_or_other-change_other_option_and_field_label-2894033-10.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

foxtrotcharlie’s picture

Status: Needs work » Needs review
FileSize
4.36 KB
881 bytes

This adds the missing schema definitions.

legolasbo’s picture

Status: Needs review » Needs work

The patch looks good, but I'd like to see some tests added to cover this functionality.

devan.chase’s picture

I've updated the patch to work with the latest dev release. This patch also adds a placeholder setting and fixes the placeholder attribute overriding the aria-label.

devan.chase’s picture

devan.chase’s picture

The patch has been updated to work with the latest dev release and also adds a placeholder setting and fixes the placeholder attribute overriding the aria-label. This patch stills needs to have the updated test cases to cover the new functionality.

Ollie222’s picture

If it helps the patch in #18 applied cleanly to dev 1812d2bcd0 and looks to work for my use case including the placeholder and label settings.

nikitagupta’s picture

Status: Needs work » Needs review
FileSize
9.48 KB

fixed test case failure.

FranckyLFS’s picture

Based on patches #18 and #20, I saw that the placeholder attribute was there, but it was not used in ElementBase. The #other_placeholder property did not override the value. So, I added it and it's functional now.

hmendes’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
55.64 KB
8.04 KB

Tested the patch from #21 and it worked for me, changing this to RTBC.

Steps:

  • Enable the module
  • Add a list field to a content type
  • Change this field form display to Select Or Other
  • Click in the options ( gear icon ) and add a new name for the option.
  • Create a content a see that the option label has changed.

Attaching screenshot for reference

  • daften committed ad05f6d on 4.x authored by FranckyLFS
    Issue #2894033 by devan.chase, foxtrotcharlie, FranckyLFS, cgoffin,...
daften’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks for the patch all!

daften’s picture

Version: 8.x-1.x-dev » 4.x-dev

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Striknin’s picture

Component: Miscellaneous » Code
FileSize
10.99 KB
4.06 KB

Hello,

This patch was very usefull into my project, thanks for that.
But :

The main wrapper should be a container instead of a form_element.

This allows to have inside only the fields that interest us (select and other), without label not joined with select or input.

All fields, should have a "#title"

But actually with patch 21, "Other" field doesn't have one if settings are empty. In case of use of "Clientside validation" or other module like this, errors can't be display with the name of the field. Instead there is a "This field field is required." for example.

Settings that we can customize (Label, name of option, placeholder) should be translatable.

This can simply be possible with the use of t() function in some places. We should maybe, make these settings translatable with the use of config translation and UI, it should be more proper.

I've created a patch, applied on tag 4.0.0 to include these modifications, I propose it in attachments (with interdiff patch).
If I can, I will post a patch that can apply on default branch (dev)