Problem/Motivation
Configuration can depend on content entities. For example:
- The default value of an entity reference field
- A views filter
- The placement of a custom block
The custom block example is especially complex since it custom block type is config, the custom block is content and the block placement is a config entity.
Proposed resolution
Add the content dependency information to the config entity.
Remaining tasks
Write patch
Review patch
User interface changes
None
API changes
Potentially additions to the config dependency system and configuration synchronisation.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 2282519.16.patch | 73.02 KB | alexpott |
| #16 | 15-16-interdiff.txt | 3.5 KB | alexpott |
| #15 | 2282519.15.patch | 70.61 KB | alexpott |
| #15 | 12-15-interdiff.txt | 1.76 KB | alexpott |
| #12 | 2282519.12.patch | 70.54 KB | alexpott |
Comments
Comment #1
alexpottComment #2
berdirI'd expect custom block to be easier to implement than the other two, actually.
a) It's static, we know what we're dealing with
b) We might not even have to care about the custom block type because we only need to worry about direct dependencies? If the custom block exists, then we can safely assume that the custom block type exists too? It's also not directly relevant for the block.
On the other side, the field default value and various views arguments and the default handling stuff are plugin-specific, and while there was already work done to convert content entity default values for fields to UUID's, this does not exist for views (which exports them as ID's), so we need to solve that problem first.
Already noticed this when trying to have default views with arguments and default values.
Comment #3
swentel commentedHow close is the related with #2278017: When a content entity type providing module is uninstalled, the entities are not fully deleted, leaving broken reference , maybe even making that one other one duplicate ?
Comment #4
catchI think they're different issues.
This one only covers configuration entities that have an explicit dependency on particular content entities, and it's open mainly because without this we can't validate deployment of configuration between instances of the same site (right now you could break a production site by deploying configuration without the requisite dependencies in place).
That issue deals with any data that has a dependency on content entities - which might well not be a configuration entity and isn't necessarily data that gets deployed (i.e. comment statistics table) - mainly for the case where modules are uninstalled.
Comment #5
catchComment #6
xjmAustin discussion notes:
https://docs.google.com/document/d/1i56Ss99rzxeSuEkThQAXi5osX9f74-9x4AX9...
Comment #7
xjmComment #8
alexpottPatch attached:
entitykey of config dependencies toconfigand adds a newcontentkeygetConfigDependencyNameis moved to the EntityInterface so content entities get it toStill to do - although I think this patch is big enough and maybe we just do the other steps in separate issues:
I'd like #2224581: Delete forum data on uninstall to land first since it changes the dependency array structure and add docs this will need to change.
Comment #10
alexpottComment #11
cilefen commentedreroll
Comment #12
alexpottRerolled as #2224581: Delete forum data on uninstall has landed. We need to do #2271419: Allow field types, widgets, formatters to specify config dependencies for entity reference default values. Views dependencies also have their own issues.
The patch has tests, documentation and a implementation for block placements of content blocks. I think we're good to go here.
Comment #13
alexpottAdded #2361423: Add a step to config import to allow contrib to create content based on config dependencies to handle the import scenario.
Comment #14
swentel commentedlooks good to me to, some minor nitpicks.
should we add a content example here as well ?
nitpick, two spaces before 'theme' and 'content'
maybe a comma after 'dependencies' ?
Comment #15
alexpottThanks for the review @swentel - patch attached addresses all the points raised.
Comment #16
alexpott@swentel pointed out in IRC that some docs were not updated with the new location of
getConfigDependencyName(). I've also improved the docs on the method.Comment #17
swentel commentedperfect!
Comment #18
alexpottDiscussed this with @damiankloip on IRC - he points out that we can have entity types that are neither content nor config - what are we going to do about them. In the current patch what 'content' really means in the config dependency array is "NOT a config entity". Anyone got any clever ideas on how to resolve. I feel that renaming "content" -> "entity" is confusing since "config" will contain config entities. This is one of the reasons why I named the original key "entity" but the problem is the config dependency system needs to treat dependencies due to config entities and content entities different.
Comment #19
yched commentedAre those "grey area" entity types something we really need to be able to specify dependencies on ?
If it's "grey area", it means there is no generic mechanism to handle those dependencies anyway ?
Comment #20
catchAgreed with yched in #19, I don't see why we'd want to generically handle unknown types of entity types here. Even content dependencies in config have a relatively limited use case in field API/Views.
Didn't review whole patch yet.
Comment #21
catchCommitted/pushed to 8.0.x, thanks!
Comment #23
arla commentedI think a change record for the changed
entitykey in the config files would be in order.Comment #24
larowlan+1 to change notice - changes to config keys is an API break for anyone with a module containing default config - should have had change notice before it was RTBC in my opinion.
Comment #25
berdirRe-opening for change record and change record updates.
Comment #26
xjmComment #27
alexpottThere are no change records to update - config dependencies was completely new.
Added a draft CR https://www.drupal.org/node/2364725
Comment #28
berdirOk thanks, that looks good enough to me for this, will publish. Not the fault of this issue that we have nothing else, maybe we should, but no need to keep this issue open.
Comment #29
alexpott