Problem/Motivation

The default value widget in Field UI may depend on the field config that is being set on the same form. Regardless of this, the default value widget is not updated when these settings change. This leads to a confusing experience. For example, if you change the allowed bundles for an entity reference field, the default value widget still allows you to reference entities based on what was allowed on the saved field config, not what has been selected on the form.

Steps to reproduce

  1. Install Umami
  2. Create a new taxonomy term reference field
  3. Select "Tags" as the allowed vocabulary
  4. Set a default value and search for "Accompaniments" which is actually a "Recipe Category" and see that its still displayed
  5. Save, and see there's a form validation error

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#6 default.png42.46 KBviren18febS
#3 drupal10.2.png51.18 KBviren18febS
#3 tags-field.png6.67 KBviren18febS

Issue fork drupal-3384583

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lauriii created an issue. See original summary.

viren18febS’s picture

Assigned: Unassigned » viren18febS

Checking the issue!

viren18febS’s picture

Assigned: viren18febS » Unassigned
Status: Active » Needs review
FileSize
6.67 KB
51.18 KB

Hi @lauriii

I have checked the issue in Drupal 10.2.0-dev and not able to reproduce the issue. screenshot attached for reference, please review.

smustgrave’s picture

Status: Needs review » Postponed (maintainer needs more info)

Also just tested this on 11.x Umami and was not able to replicate. Is there a missing step?

lauriii’s picture

Status: Postponed (maintainer needs more info) » Active

Did you test this on the default value widget? Based on the screenshot in #3 it's not clear if that's the case or not.

viren18febS’s picture

Status: Active » Needs review
FileSize
42.46 KB

@lauriii

I have created a Term reference field & select Tag as the allowed vocabulary and not changed any configuration for widget. I have attached a screen shot, please review.

smustgrave’s picture

Status: Needs review » Active

Confirmed the issue following steps in Issue summary.

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

srishtiiee’s picture

Status: Active » Needs review
smustgrave’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Slightly updated steps to reproduce.

Manual testing following the steps in the issue summary confirmed when setting the default value I can search other vocabularies outside tags.
MR did resolve the issue.

Rebased the issue to run the test only feature

There was 1 failure:
1) Drupal\Tests\field_ui\FunctionalJavascript\DefaultValueWidgetTest::testDefaultValueOptionsForChangingBundles
Failed asserting that actual size 4 matches expected size 2.
/builds/issue/drupal-3384583/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:122
/builds/issue/drupal-3384583/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55
/builds/issue/drupal-3384583/core/modules/field_ui/tests/src/FunctionalJavascript/DefaultValueWidgetTest.php:79
/builds/issue/drupal-3384583/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
FAILURES!

Which is good.

  • lauriii committed 710ae1c8 on 11.x
    Issue #3384583 by srishtiiee, viren18febS, smustgrave: Default value...

  • lauriii committed e2872efa on 10.2.x
    Issue #3384583 by srishtiiee, viren18febS, smustgrave: Default value...

lauriii’s picture

Version: 11.x-dev » 10.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed 710ae1c and pushed to 11.x. Also cherry-picked to 10.2.x. Thanks!

Status: Fixed » Closed (fixed)

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