Problem/Motivation

The Allow Only One module can be added, but when changing configuration options for the field type during setup, it presents an Ajax error.

In my case, the error is:

ResponseText: The website encountered an unexpected error. Try again later.UnexpectedValueException: The subform is not contained by the given parent form. in Drupal\Core\Form\SubformState->getParents() (line 92 of core/lib/Drupal/Core/Form/SubformState.php). Drupal\Core\Form\SubformState->getValues() (Line: 26)

The error's message makes me think directly to an incompatibilty with the 10.2 changes around forms and subforms in:
https://www.drupal.org/node/3386675
https://www.drupal.org/node/3391654
https://www.drupal.org/node/3347291

Other modules had this same type of issue, according to issues like:
https://www.drupal.org/project/metatag/issues/3419378
https://www.drupal.org/project/readonly_html_field/issues/3426382
https://www.drupal.org/project/custom_field/issues/3400256
https://www.drupal.org/project/datafield/issues/3409324

Steps to reproduce

- Install the Allow Only One module
- On the "Manage fields" of any entity bundle, add a field as follow.
- Add a field label
- Choose "Allow Only One" as the field type
- Click "Continue" button
- Under "Allowed number of values", change the setting and witness and Ajax error

Proposed resolution

- Make the Allow Only One module compatible with the Drupal core 10.2 field UI changes

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

joshua.boltz created an issue. See original summary.

joshua.boltz’s picture

Issue summary: View changes
swirt’s picture

Thank you for reporting this @joshua.boltz. I will look into this soon.

kaise.lafrai’s picture

Just wanted to add an update here. I'm working on compatibility fixes for the next couple days. Thank you for your patience!

kaise.lafrai’s picture

A fix is ready for this issue that addresses compatibility with Drupal 10.2 and even Drupal 11.

swirt’s picture

Status: Active » Reviewed & tested by the community

  • kaise.lafrai committed 6c46d560 on 1.0.x
    Issue #3465556 by kaise.lafrai: Incompatibility with Drupal 10.2 field...
kaise.lafrai’s picture

kaise.lafrai’s picture

Thank you for testing this Swirt!

swirt’s picture

Status: Reviewed & tested by the community » Fixed
swirt’s picture

Status: Fixed » Closed (fixed)

Release in 1.0.3