from the project page:

Uses one variable for each content type when the best option is use only one variable with the info of all content types

This is not the best option by far, this is a wrong design. The config should be split up per content type.
something like:
node_revision_delete.settings.node.page.yml
node_revision_delete.settings.node.article.yml

Reasons:
- The default configuration is not easily included in custom modules (or features). Like when a module creates a new content type, it would be nice to be able to include the revision delete config for that one content type.
- Parts of the configuration are not deleted when dependent module/configuration is deleted.

See similar issues in other contrib modules:
#2998934: Split up config with schema refactor to have Enhancer for each given entity browser widget separately per entity browser
#2876280: Split config
#2795141: Config in Purge module could be better organized

Comments

Pasqualle created an issue. See original summary.

pasqualle’s picture

Issue summary: View changes
adriancid’s picture

Category: Task » Feature request

Hi @Pasqualle thanks for reporting, can you use the next time the Issue Summary Template?

I never thought on that way, but reading the similar issues, I see why is better to split the configuration by content type.

I will see if I can find some moment to change this.

Then, we will have a configuration for each content type and a general configuration for the module? Something like:

node_revision_delete.settings.node.CONTENT_TYPE.yml
node_revision_delete.settings.yml

?

pasqualle’s picture

Yes, generally if we are dealing with different entity bundles, then those should be in separate config files. I have only encountered one case when different entity bundles are listed in one config: in entity_reference field target_bundles list. This list is hard to manage when creating distributions (install profiles), and I think the list should be split up somehow in the future (or the config system should be somehow improved).

There is no general rule how to name the config files, the coding standards does not include our case.
node_revision_delete.settings.node.CONTENT_TYPE.yml
I think using entity type and bundle name (content type) after the second dot in config file name seems to be a good pattern, even the entity_type "node" seems redundant, as this module only deals with nodes, no other entity types. I like that pattern maybe because D8 modules are mostly dealing with all content entity types not just nodes, like entity_revision_delete.settings.node.page.yml filename would be nice and clear.

There is even an option to not use a new config file, but use the third_party_settings in node.type.CONTENT_TYPE.yml
Then the node.type.page.yml would be something like:

langcode: en
status: true
dependencies:
  module:
    - menu_ui
    - node_revision_delete
third_party_settings:
  menu_ui:
    available_menus: {  }
    parent: ''
  node_revision_delete:
    minimum_revisions_to_keep: 8
    minimum_age_to_delete: 12
    when_to_delete: 3
name: 'Page'
type: page
description: 'Custom page.'
help: ''
new_revision: true
preview_mode: 0
display_submitted: false

Step by step tutorial on how to add third_party_settings into config entities.

The third_party_settings seems like the common approach, but third_party_settings on node.type will currently result in an issue #2922417: Profile provided configuration entities can have unmeetable dependencies when the config is used in install profile. Hopefully the issue will be fixed in Drupal 8.7

adriancid’s picture

Title: Split up config » Store the content type configuration into its configuration file
Assigned: Unassigned » adriancid

  • adriancid committed 5a9c297 on 8.x-1.x
    Issue #3012573 by Pasqualle, adriancid: Store the content type...
adriancid’s picture

Status: Active » Fixed
adriancid’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.