Problem/Motivation

Just tried to set a taxonomy term field to non-required in the field UI, and the field persisted as required in the form.

This is because forum_form_node_form_alter() forces the widget to required regardless of the setting. The comment says for 'proper' forum modes, but this occurs for any node type using that vocabulary. The only way I was able to find out what this was happening was because I guessed there'd be an alter in forum module forcing the behaviour, but that was after a few minutes head scratching.

Proposed resolution

Remove the line setting the vocabulary to required to allow the field UI to work as expected.

Remaining tasks

Tagging novice because this should be a one-line patch.

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch created an issue. See original summary.

EmiliaC’s picture

I attached the patch where i removed the line making the widget required.
Please review the below, thank you!

EmiliaC’s picture

Status: Active » Needs review
borisson_’s picture

Status: Needs review » Reviewed & tested by the community

This patch does exactly what @catch asked. Thanks @EmiliaC!

catch’s picture

Status: Reviewed & tested by the community » Needs work

I don't think this needs test coverage- we'd be testing the standard behaviour of the widget which is already tested.

One more thing to do here though, which is to remove the comment right above that line.

EmiliaC’s picture

I have now removed the comment and added the patch.

borisson_’s picture

Status: Needs work » Reviewed & tested by the community

I agree with #5 testcoverage doesn't seem to be needed here.
The comment is now removed as well, so that's good. Back to RTBC this goes.

plach’s picture

It's ok to do this since the node field instance is marked as required by default so we are preserving the previous behavior:

https://git.drupalcode.org/project/drupal/blob/e14126d6a8ddcce5ee35ebcd3...

plach’s picture

Version: 8.8.x-dev » 8.7.x-dev

Committed 6483dcd and pushed to 8.8.x. Thanks!

  • plach committed 6483dcd on 8.8.x
    Issue #3052413 by EmiliaC, catch: Forum vocabulary is overridden to...
plach’s picture

Version: 8.7.x-dev » 8.8.x-dev
Status: Reviewed & tested by the community » Fixed

Given that this changes a form array, it's probably better to keep this 8.8.x only.

Status: Fixed » Closed (fixed)

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