Problem/Motivation

When a content type is configured to not be associated with any menu the empty options for that choice are saved in the node type config entity as third party settings and that creates fake dependency on menu_ui.

Steps to reproduce

- Create a new content type and uncheck all options for "menu settings".
- Inspect the configuration created and notice the following configuration

dependencies:
  module:
    - menu_ui
third_party_settings:
  menu_ui:
    available_menus: {  }
    parent: ''

Proposed resolution

Stop storing third party settings when the choices are empty.
Only apply the defaults (preselect the main menu) when the content type is created for the first time.

Remaining tasks

Code the solution

User interface changes

None

API changes

None

Data model changes

Node types will store less configuration when they are not associated with a menu

Release notes snippet

Content types that are not associated with any menu won't store third party settings anymore.

Issue fork drupal-3312978

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

rodrigoaguilera created an issue. See original summary.

rodrigoaguilera’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work

MR needs to rebased and also there are test failures.

smustgrave’s picture

Before more work is done will let the subsystem maintainer give their thoughts.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)

So recently that became me as one of them. Looking at this again years later not sure it's something we should do. Looking at config throughout we have empty third_party_settings already. Think it's good to have the key for consistency. If no objections I would close this won't fix.

Saving credit to rodrigoaguilera for initial works

rodrigoaguilera’s picture

Status: Postponed (maintainer needs more info) » Needs work

If I remember right the inconsistent behavior here is that a content type was configured with no menus available and later coming back to the edit content type form and saving that same content type the choice of "no menus" is not respected. Can we at least fix that?
I think the test for this should focus on that odd behavior.

I did a quick search in core for "unsetThirdPartySetting" and there is modules cleaning the empty third party settings like content translation and layout builder. Do you have an example of empty third party settings?

smustgrave’s picture

I searched my config sync directory and it’s all over the place

rodrigoaguilera’s picture

With "empty" I refer to the third_party_settings of menu_ui. No available menus and no parent like this

dependencies:
  module:
    - menu_ui
third_party_settings:
  menu_ui:
    available_menus: {  }
    parent: ''

I too have a lot of

third_party_settings: {  }

in my sync directory and that is 100% normal

smustgrave’s picture

To me though that looks fine. If I were to inspect that config yml file id be more concerned if keys were missing vs empty.

But happy to leave this open for others to chime in

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.