Problem/Motivation
After enabling Require summary
on a Basic Block, new blocks cannot be created and Require summary
cannot be disabled.
Steps to reproduce
- Navigate to
/admin/structure/block/block-content/manage/basic/fields/block_content.basic.body
- Enable
Require summary
(but notSummary input
) - Save (Message:
Saved Body configuration
) - Navigate to
/admin/structure/block/block-content
- Add custom block
- Note: only Block description and Body field are visible, no summary
- Add description
- Add body
- Error:
Summary field is required.
. Note: This behavior is different in Drupal 9.5. There is no longer an error on save. See comment #59. - Back to
/admin/structure/block/block-content/manage/basic/fields/block_content.basic.body
- Note: summary is not visible
- Disable
Require summary
- Error:
Summary field is required.
. Note: This behavior is different in Drupal 9.5. There is no longer an error on save. See comment #59.
I also tested on an existing site (8.8.2) on the body field on a content type and body field on a Product (commerce module), with the same results. Also, on a new content type:
- Deleted the default body field and added a new text w/ summary field
- Save
- Edited, enabled Require summary
- Save
- Same results--unable to add entity or edit the text field under Manage Fields.
If I enable Summary input
at the same time as Require summary
, then the summary is displayed when adding the entity and when I edit the field, but I still can't disable it. If I fill out the default value summary, then I can disable and save.
Screenshots
Before:
After:
Proposed resolution
Update the form validation to require that Summary input
must be enabled before Require summary
can be enabled.
Remaining tasks
Create patchReview patch- Answer outstanding questions
- Test patch
- Commit
Outstanding questions
Outstanding questions (see comments in #38, #53, and #59 for reference).
When editing the text field on an entity:
- When the Summary input is enabled/checked, should the Summary field under Default value automatically display? Or should it only display after the field has been saved? How is this handled in other places?
- When the Summary input is disabled/unchecked, what should happen to any existing values in the Summary field?
- When Summary input is disabled/unchecked should Require summary be automatically unchecked?