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
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:
- 3312978-avoid-storing-empty
changes, plain diff MR !2823
Comments
Comment #3
rodrigoaguileraComment #4
smustgrave commentedMR needs to rebased and also there are test failures.
Comment #5
smustgrave commentedBefore more work is done will let the subsystem maintainer give their thoughts.
Comment #7
smustgrave commentedSo 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
Comment #9
rodrigoaguileraIf 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?
Comment #10
smustgrave commentedI searched my config sync directory and it’s all over the place
Comment #11
rodrigoaguileraWith "empty" I refer to the third_party_settings of menu_ui. No available menus and no parent like this
I too have a lot of
in my sync directory and that is 100% normal
Comment #12
smustgrave commentedTo 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