Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork webform-3493832

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

jrockowitz created an issue. See original summary.

colan made their first commit to this issue’s fork.

colan’s picture

Status: Active » Needs review

Resolved merge conflict. Problem was that we're hacking on the file modules/webform_toggles/js/webform_toggles.element.js that's no longer there due to #3489932: Move deprecated modules into webform_deprecated. I simply removed the file. If folks are interested in making this change in Webform Deprecated, they can dig it out of the commit.

colan’s picture

Here's a Composer-friendly patch that assumes #3452986-18: Update jquery.intl-tel-input to v23.0.10 and add option for i18n has already been applied.

jrockowitz’s picture

People should weigh-in if this enhancement is useful.

luke.leber’s picture

I think the concept is useful, but sometimes the customization can't be hard-coded as data attributes, but rather rely on runtime information.

One example is for the international telephone element. See https://git.drupalcode.org/project/webform_intl_tel_national_mode/-/blob... for a somewhat heavy handed fix for how most UX problems were resolved.

Were there a client side event to tap into, it'd make things a lot easier to tweak. I would LOVE to take a holistic pass on the telephone input given how many quirks there are, and if there was more robust options handling, that'd be even easier.

jrockowitz’s picture

Status: Needs review » Reviewed & tested by the community

Were there a client side event to tap into, it'd make things a lot easier to tweak.

I would be very open to adding a simple alter options event below all instances of

          // Allow custom options.
          if ($select.attr('data-options')) {
            options = $.extend(JSON.parse($input.attr('data-options')), options);
          }

I am not sure of the right syntax, maybe this could be a later enhancement.

I am leaning toward merging this AS-IS.

liam morland’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll
divyansh.gupta’s picture

Assigned: Unassigned » divyansh.gupta

Working on the rebase.

divyansh.gupta’s picture

Assigned: divyansh.gupta » Unassigned
Status: Needs work » Needs review

Rerolled the MR,
Please review!!

jrockowitz’s picture

Status: Needs review » Reviewed & tested by the community

RTBC if tests pass

  • b085c3af committed on 6.3.x
    Issue #3493832: Allow custom data-options to added to elements...
jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed

I couldn't merge the MR so I applied the patch without any problems

  • b085c3af committed on 6.x
    Issue #3493832: Allow custom data-options to added to elements...

Status: Fixed » Closed (fixed)

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

liam morland’s picture

liam morland’s picture

Title: Allow custom data-options to added to elements JavaScript options » Allow custom data-options to be added to elements JavaScript options
Category: Task » Feature request
Issue tags: -Needs reroll
liam morland’s picture

Status: Closed (fixed) » Active
Issue tags: +Needs tests

This lead to #3567475: Impossible to add custom options to Select2 due to undefined variable which has now been fixed. This should have tests.