Mark Editor config schema as fully validatable

Created on 4 January 2024, about 1 year ago
Updated 29 July 2024, 6 months ago

Problem/Motivation

This issue is spun off from #3364108-94: Configuration schema & required keys . @effulgentsia said:

My only hesitation ... is the various changes in here related to enforcing the lack of any other keys when an editor's image_upload.status is FALSE. For example, the need to remove those other keys from Umami's editor.editor.basic_html.yml. I think that should all be removed from this MR and moved to a follow-up that gets its own commit and its own change record.

This is that follow-up. Refer to 📌 Configuration schema & required keys Fixed for all the rationale and discussion that brought it about!

Proposed resolution

  1. First, restructure the config schema for editor.editor.*:image_upload, to allow making only editor.editor.*:image_upload.status required ALWAYS (for this, the new editor.image_upload_settings.* type is added). All other keys should be only required if that is set to true (for this, the new editor.image_upload_settings.1 type is added).
  2. Second, mark the following types as fully validatable:
    • editor.editor.* (aka the config schema type for the Editor config entity type)
    • editor.image_upload_settings.* (contains only status)
    • editor.image_upload_settings.1 (contains everything else: upload directory, max size, etc.)
  3. In order to make all those fully validatable, some changes/additions are needed to perform the necessary validation:
  4. An automatic update path to:
    • convert editor.editor.*:image_upload.directory from '' to null (to indicate that the root of the chosen stream wrapper should be used)
    • convert editor.editor.*:image_upload.max_size from '' to null (to indicate that there is no lower file upload limit than the maximum allowed by the current PHP environment)
    • convert editor.editor.*:image_upload.max_dimensions.width from 0 to null (to indicate that there is no max width)
    • convert editor.editor.*:image_upload.max_dimensions.height from 0 to null (to indicate that there is no max height)
  5. One addition to the list of ignored property paths, due to a newly discovered edge case bug deep in the config system: 🐛 Stream wrappers not registered when installing module's default config Active — but only the validation error message for when this edge case occurs is ignored 👍
  6. Minimize changes to tests: only missing required keys were added. When the necessary keys were present, incorrect values (such as a max width of 0) can remain in place in tests, they are automatically updated by the editor_editor_presave -powered update path. This proves that we'll be able to minimize contrib disruption, and allow for gradual updates. Instead of 54 files,+838,-115, this made the MR 35 files,+734,-92.

API changes

No changes, but 1 API addition:

  1. To make editor.editor.*:image_upload.scheme validatable, \Drupal\editor\Entity\Editor::getValidStreamWrappers() was added
Feature request
Status

Fixed

Version

10.3

Component
Editor 

Last updated 12 days ago

Created by

🇺🇸United States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
  • API addition

    Enhances an existing API or introduces a new subsystem. Depending on the size and impact, possibly backportable to earlier major versions.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024