Problem/Motivation

Upgrading from 2.0 to 2.1 causes the Summary field to be required unconditionally.

Steps to reproduce

Drupal 10.3
Upgrade to 2.1
Edit a piece of content with a text with summary field
Click the "Edit Summary" link
Summary is expanded and is required, regardless of the field's summary required settings
This is caused by the condition having been removed in text_summary_options.module
Not sure why it was decided to unconditionally mark the field as required, but doesn't seem to make sense
The original code was conditional on Drupal version 8.8, so maybe I'm missing something in the thread

Proposed resolution

Add back the condition, if ($required_summary_setting) before doing $element['summary']['#required'] = TRUE;

Remaining tasks

Check the required status instead of setting it to TRUE unconditionally. Again, not sure if the Drupal version affects how this is checked.

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

darkodev created an issue. See original summary.

darkodev’s picture

Issue summary: View changes
darkodev’s picture

Issue summary: View changes

kim.pepper made their first commit to this issue’s fork.

kim.pepper’s picture

Status: Active » Needs review

I didn't remove enough of the logic that was < 8.8

kim.pepper’s picture

I added a test to confirm the expected behavior. Unfortunately the test-only job failed to run due to the addition of composer.json. @darkodev perhaps you can confirm this works for you in your setup?

darkodev’s picture

Status: Needs review » Reviewed & tested by the community

RTBC +1.

The module now respects the "Require summary" field setting.

Thanks for fixing that!

  • kim.pepper committed 33335b00 on 2.x
    Issue #3467688: 2.1 update makes the Summary field unconditionally...
kim.pepper’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 2.x. Thanks!

Status: Fixed » Closed (fixed)

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