Unable to save text format without enabling Markdown filter

Created on 27 August 2024, 3 months ago
Updated 20 September 2024, about 2 months ago

Problem/Motivation

When saving a text format that is not configured to utilize the markdown filter, there is a validation error occurring prevent the configuration form to be saved.

Steps to reproduce

Drupal core 10.3.2
Markdown 3.0.1

  • Go to /admin/config/development/logging
  • Configure and save error display option, e.g. Errors and warnings
  • Install and configure Markdown
  • Create new or edit existing text format
  • Do not enable markdown filter
  • Click Save
  • Observe error message, "'vertical_tabs' is not a supported key."
  • Uninstall Markdown module
  • Create new or edit existing text format
  • Do not enable markdown filter
  • Click Save
  • Observe no error message

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

πŸ› Bug report
Status

Active

Version

3.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States jasonawant New Orleans, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jasonawant
  • πŸ‡ΊπŸ‡ΈUnited States jasonawant New Orleans, USA

    I think this particular error is a result of config schema validation by Durpal core's ValidKeysConstraint, see change record https://www.drupal.org/node/3324853 β†’

    I think the solution to this issue could be along the lines of the following:

    1. Refine the Markdown filter plugin form and configuration to remove vertical_tabs from the saved form_state
    I think when saving the filter without Markdown enabled, vertical_tabs is left in the form_state and it is being saved with the markdown filter settings; however, vertical_tabs is not a key defined with the filter_settings.markdown schema.

    2. Further define the schema for the markdown filter settings

    Here's how Drupal core's filter_html schema is defined here

    filter_settings.filter_html:
      type: mapping
      label: 'Filter HTML'
      mapping:
        allowed_html:
          type: string
          label: 'Allowed HTML'
        filter_html_help:
          type: boolean
          label: 'HTML help'
        filter_html_nofollow:
          type: boolean
          label: 'HTML nofollow'
    

    Compared to the markdown filter schema here

    # Filter settings.
    filter_settings.markdown:
      type: markdown.parser
      mapping:
        override:
          type: boolean
          label: 'Override'
    
Production build 0.71.5 2024