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 dmg as a module dependency.

Steps to reproduce

  1. Install DMG at a commit before #3508221 (for example e79bb50).
  2. Add guidelines to a view mode or form mode and save it.
  3. Update DMG to the current 1.x and run drush updatedb. There are no pending updates.
  4. Open /admin/structure/display-modes/view. The guidelines are gone, and drush config:get core.entity_view_mode.node.MODE shows them still sitting under third_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 dmg third-party setting, so saving the display mode drops the dmg dependency.

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

e0ipso created an issue. See original summary.

e0ipso’s picture

Issue summary: View changes

  • e0ipso committed 22e233ac on 3633270-upgrade-path
    fix: #3633270 Add an upgrade path for guidelines moved into the display...

  • e0ipso committed 5889b55f on 3633270-upgrade-path
    fix: #3633270 Add an upgrade path for guidelines moved into the display...

  • e0ipso committed 87e06835 on 1.x
    fix: #3633270 Add an upgrade path for guidelines moved into the display...
e0ipso’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.