Generated with the help of an LLM.

Problem/Motivation

On a display with content overrides on, emptying the profile on Manage display unsets the override settings, then writes them back.
EntityViewDisplayFormHook::submitForm() clears override_field and override_profile for an empty profile, but the override_status block runs next: the checkbox is still checked, only hidden by #states.
The display keeps override_field and override_profile with no profile, and the override field stays locked.

Steps to reproduce

  1. On a content type's Manage display, select a profile, check Enable content overrides and save.
  2. Select no profile and save.
  3. Export the display: third_party_settings.display_builder still holds override_field and override_profile. The override field storage is still locked.

Proposed resolution

Skip the override_status block when the profile is empty.

Remaining tasks

  1. Functional test submitting the form with an empty profile.
  2. Fix.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mogtofu33 created an issue. See original summary.

pdureau’s picture

Functional test submitting the form with an empty profile.

Maybe we just need to adapt the existing EntityViewDisplayFormTest::assertEnableAndDisable(), which may be hiding the bug by "unchecking" override_status when it disables Display Builder:

    // The overrides checkbox stays checked: #states only hides it.
    $this->submitForm([
      DisplayBuildableInterface::PROFILE_PROPERTY => '',
      'override_status' => FALSE,
    ], 'Save');

pdureau’s picture

Assigned: Unassigned » pdureau
Status: Active » Needs work
pdureau’s picture

Assigned: pdureau » Unassigned
Status: Needs work » Needs review

OK for me:

  1. On a content type's Manage display, select a profile, check Enable content overrides and save.
  2. Select no profile and save.

Results:

  • Export the display: no override_field and override_profile anymore: ✅
  • The override field storage is not locked anymore: ✅

Open for review.

  • mogtofu33 committed 2b030c71 on 1.0.x authored by pdureau
    fix: #3637740 Turning off Display Builder on a display keeps its content...
mogtofu33’s picture

Status: Needs review » Fixed

Thanks works great!

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.