az-digital / az_quickstart

UArizona's web content management system built with Drupal 10.
https://quickstart.arizona.edu
GNU General Public License v2.0
30 stars 20 forks source link

Can not modify field settings for fields using plain text formatter. #2346

Open trackleft opened 1 year ago

trackleft commented 1 year ago

Problem/Motivation

While attempting to enable linkchecker module, I found that I was not able to update the field settings for the az_summary field for az_flexible_page.

Describe the bug

Form can not validate

joshuasosa commented 1 year ago

I ran into this issue as well. I migrated a site and disabled a bunch of old text formats. I didn't disable "Plain text" (I don't think I can in the UI), but somehow, the text format got unset from az_summary on az_flexible_page, preventing me from saving pages. Going in to edit the field and trying to re-save gives the error "The selected text format is not allowed." I'm not sure if this is the same error encountered with the bug reported in this issue, but I'll provide my troubleshooting steps and solution.

Looking further, the configuration for field.field.node.az_flexible_page.field_az_summary shows:

settings:
  allowed_formats:
    - plain_text

If I unset that by re-importing with this:

settings:
  allowed_formats: {}

And then go back to the field setting, I can set Plain text or another type without error. But re-saving gives the error again. I think it has to do with the fact that default value is displayed and Plain text is not a text formatted that can be selected in that default value.

Allow text field to enforce a specific text format might be related, and I see a patch is included in AZQS for 10.0.x. But the issue still comes up with vanilla Drupal 10.1.14.

The solution is to enable the fallback text format to always be shown: drush cset filter.settings always_show_fallback_choice TRUE Reference: How to enable plain text format for body in specific content type

Then when I go to edit the field, I can select Plain text in the default area's text format and save.

It'd be better to just not display default, but I don't see an option to disable that. It looks like that became an option in Drupal 10.1.