Problem/Motivation
#3508221: Deprecate the "guidelines" field in favor of description moved display mode guidelines from the dmg.guidelines third-party setting into the core description property of view and form modes. It shipped without an update function.
Sites that saved guidelines before that commit still have them in third_party_settings.dmg.guidelines, but the module no longer reads that value. As a result:
- The guidelines no longer appear on the display mode list, the display mode edit form, or the "Manage display" and "Manage form display" pages.
- The Description field on the edit form is required and starts out empty, so site builders have to type the guidelines in again.
- The module removed the config schema for
third_party.dmg, so the old values now fail schema validation. - The display modes still list
dmgas a module dependency.
Steps to reproduce
- Install DMG at a commit before #3508221 (for example e79bb50).
- Add guidelines to a view mode or form mode and save it.
- Update DMG to the current 1.x and run
drush updatedb. There are no pending updates. - Open
/admin/structure/display-modes/view. The guidelines are gone, anddrush config:get core.entity_view_mode.node.MODEshows them still sitting underthird_party_settings.dmg.
Proposed resolution
Add two post update functions, one for view modes and one for form modes. Each uses ConfigEntityUpdater to go through every display mode that has dmg third-party settings and:
- copies the guidelines into the description when the description is empty or already holds the same text;
- keeps both when the description holds different text: the old description is HTML-escaped and wrapped in
<p>, and the guidelines follow it. Core used to show the description as plain text, and DMG now renders it as HTML, so escaping keeps it looking the same; - removes the
dmgthird-party setting, so saving the display mode drops thedmgdependency.
Display modes without DMG settings are not saved again.
The MR also fixes the view mapping in dmg.settings, whose label in the schema is Form instead of View.
Remaining tasks
- Review the merge rule for display modes that have both a description and guidelines.
- Review the MR. It includes a kernel test that writes old-style config straight to storage, runs both post updates, and checks the result against the config schema.
User interface changes
None. Guidelines saved before #3508221 show up again wherever the description is shown.
API changes
None.
Data model changes
The update moves third_party_settings.dmg.guidelines into description on core.entity_view_mode.*.* and core.entity_form_mode.*.*. DMG no longer appears in the dependencies of those display modes. Export your configuration after running the updates.
Release notes snippet
Display mode guidelines now live in the core display mode description. Run drush updatedb to move existing guidelines, then export your configuration.
Comments
Comment #2
e0ipsoComment #6
e0ipso