Problem/Motivation
Admin listings of configuration entities load and display the configuration entity with overrides applied (eg. using the language negotiated for the page). This looks flawless on the page itself. Eg. if you view a Hungarian admin page for content types, you get to see the Hungarian name of content types and their Hungarian descriptions. The problem starts when you actually want to edit it. Well, once you hit the edit screen, you'll ("obviously") edit the original configuration entity that is for shipped content types the English configuration. This is true for all kinds of overrides, eg. group based, time based, global settings based, etc.
This is not that bad maybe for content types, but for date formats for example, it can be pretty confusing. Eg. you see a preview of a date format (in Hungarian), then you go edit it, and it is not the date format you've seen in the summary table.
Proposed resolution
Configuration entity admin lists should load / show configuration in their original override-free form.
Remaining tasks
Do it.
Review.
Commit.
User interface changes
Configuration entities will show up in their original form in the admin listings (ie. same language that you get when you go edit them).
API changes
Probably none.
Comment | File | Size | Author |
---|---|---|---|
#32 | interdiff.txt | 3.81 KB | Gábor Hojtsy |
#32 | 2136559-load-original-entity-31.patch | 9.24 KB | Gábor Hojtsy |
#27 | interdiff.txt | 3.74 KB | Gábor Hojtsy |
#27 | 2136559-load-original-entity-27.patch | 10.43 KB | Gábor Hojtsy |
#23 | 2136559-load-original-entity-23.patch | 10.41 KB | Gábor Hojtsy |
Comments
Comment #1
tim.plunkettArghhh I looked for this issue before opening #2251915: Overridden config entity bleeds through to admin forms, but couldn't find it. Marking as a dupe.
Comment #2
tim.plunkettAfter re-re-reading this issue, this is NOT covered by #2251915: Overridden config entity bleeds through to admin forms.
In fact, I'm not personally sure we should do this issue.
Reopening for discussion.
Comment #3
Gábor Hojtsy@tim.plunkett: well, the problem is in your views list you see a view named "Honlap", you go edit int and "Honlap" is nowhere to be found because its the translation of the name, so you can only see "Frontpage". Is this not the same level of issue then (critical?).
Comment #4
catchThis feels major to me, there's no issue with writing the configuration entities back incorrectly, and it should be straightforward to fix after release.
Comment #5
pwolanin CreditAttribution: pwolanin commentedSo, seems this will be an issue with localized and translated menu links also.
Comment #6
Gábor HojtsyComment #7
Gábor HojtsyAdding #2392319: Config objects (but not config entities) should by default be immutable as related.
Comment #8
Gábor HojtsySo ConfigEntityListBuilder::load() is where the loading happens for the list. I *could* put in an overridestate get/set there but this uses the injected storage to load the values. The injected storage is a ConfigEntityStorage, which in turn has an injected config factory. So doing the overridestate get/set on that ConfigFactory is needed. So basically we need to introduce methods to load override-free config entities one by one or in bulk.
Here is a proof of concept patch that is untested for now.
Comment #10
jhodgdonUm. On another issue, we added the ability to, on a particular admin route, tell it to not translate config entities.
Here's an example from the help topic entity routing.yml file:
Couldn't that be used here? What is being done looks very complicated...
Comment #11
jhodgdonOh never mind, it's the opposite. :(
Comment #12
Gábor Hojtsy@jhodgdon: in this issue, the entity does not come from upcasting but an entity list controller loads it explicitly (in bulk even).
Comment #13
Gábor HojtsyUpdating the entity listing / edit test first.
Comment #15
Gábor Hojtsy1. We don't need that test page to ensure the overrides applied. We can just use the API in the test. Should fix the entity edit page test.
2. The key-value storage test used an entity class for storing config entities that did not implement the config entity storage interface. Hah! So by implementing that and injecting the config factory we need it is fixed. I did not see a point implementing the methods in this storage which are not tested, it would be definitely out of scope for this issue to implement those and test them.
The previously failing tests are passing locally now. Let's see the whole suit.
Comment #16
Gábor HojtsyComment #17
BerdirWhat about settings.php overrides?
If we never use the overrides in those admin lists, how does a user know that they are actually applied? And what if those values are actually used somehow?
Let's take search api servers as an example. You have an override locally to use a different solr server, and overview list somehow uses that value to do a connection check.
Comment #18
Gábor Hojtsy@Berdir: That is what I opened "Figure out if we want global config overrides to stick (settings.php overrides don't work on all pages)" originally. Now retitled / rescoped to #1934152: FormBase::config() and ConfigFormBase::config() work entirely differently, may result in unexpected side effects. As a matter of fact, whatever is displayed in this overview, the actual editing screen will not edit overridden data (unless some modules changes the code behavior, which can equally change the listing behavior). So whatever we display in this list (eg. solr server), the edit form will not display / let you edit that. If you have an entity operation on the solr server config entity that does the connection check, it will be an admin path as well I guess, so that will get the entity upcast without overrides as well, so will do the connection check for the non-overridden server also (already, without this patch).
Comment #19
Gábor Hojtsy@alexpott asked me to consult @tim.plunkett for this issue. Quick feedback I got so far is "I'm fine with introducing KeyValueConfigEntityStorage". Asked him to post his feedback here.
Comment #20
tim.plunkettI think this is completely fine. +1 to the addition.
Is there any worth in making these a trait?
missing the {}
Test changes look solid.
Comment #21
Gábor Hojtsy@tim.plunkett: while I could move this to a trait, it would not work independently. The methods need the injected config factory that is in these classes already. We could add a setter for a specific config factory for these methods but that would be parallel to the already existing factory, no?
Comment #22
Gábor HojtsyUpdating the code comments. @tim.plunkett what do you think?
Comment #23
Gábor Hojtsy@tim.plunkett pointed out I had default.services.yml and default.settings.php hunks in my patch which were not intended. Just removed those.
Comment #24
Gábor Hojtsy@berdir: I think your concerns are addressed with the use_current_language upcasting option as used in #2137595-26: 'Create @name' page title uses override-free configuration (eg. not localized) instead of the overridden configuration (eg. localized) for example. Note that the option is misleadingly named, it toggles all overrides. See #2405939: use_current_language upcasting option is misleading, it toggles all overrides not just language.
Comment #25
tim.plunkettThe only reason this worries me is because of issues like #1798332: Add paging to the EntityListBuilder, that improve parent::load(), and this would miss out on that, and need to duplicate that code.
This is unrelated to the trait I requested before, and I don't really see a viable solution.
I'm going to RTBC because this is a good fix with good coverage, and we'll deal with it in the paging issue.
Comment #26
alexpottHow about loadOverrideFree(), loadMultipleOverrideFree() - I think original might be confused with the original property on the entity and the getOriginal method on config objects.
Comment #27
Gábor HojtsyI am fine with those names too. Rolled a quick rename.
Comment #28
Berdirmixed was never true, and for config, we can limit it to string I think, but there's to argument to keep it consistent, so fine.
@return could also say ConfigEntityInterface, but again.
If we actually claim that this is a valid storage for config entities, shouldn't we implement this?
Yay, more arguments for me that this should live in a test module :)
Uhm, this makes no sense :)
Key value doesn't use config for storage, so messing with the config factory is pointless?
All key value stored entities are override free, so you could just forward to load()/loadMultiple().
Either way, even more arguments that we can *not* be serious about offering this as a storage for config.
Comment #29
BerdirSee #2393751: Document that KeyValueEntityStorage is not scalable beyond a few hundred entities for a bit more context about why I need arguments ;)
Comment #30
Gábor Hojtsy@Berdir:
1. Re the docs of the new methods, I copied them from the docs on the current interface methods, because they are the same. Should be consistent no?
2. Re implementing those methods as well, they were not implemented before and not needed in this test either. They are not being tested, so if we are to implement them, we would need to test them. That I added them is merely technical here.
3. Indeed the addition of the config factory in this issue is/was arbitrary and we should just forward to load/loadMultiple for the scope of this patch. That the key/value storage cannot actually be used to store config because it cannot store overrides is an implementation detail, it could form its keys accordingly :) That is also a pre-existing condition and not in scope to fix. It is not made worse or better by this patch.
Needs work for 3 (removing the config factory and forwarding to load/loadmultiple).
Comment #31
Berdir1. I know you did, but because we know that the ID is a config entity, we know that it has to be a string :) Anyway, as mentioned, fine with keeping it.
2. & 3. Well, the difference is, now you explicitly provide a key value entity storage *for config entities*, which looks like it is there to support config entities, when it in fact it does not ;) Again, I would have no problem at all with this if it were clear that it is a test implementation :)
Comment #32
Gábor HojtsyHere is that update. I looked at KeyValueEntityStorage vs. ConfigEntityStorage, and indeed the way the latter implements "override support" is by relying on an injected config factory (the config factory maintains overrides not the config object). KeyValueEntityStorage is totally config factory agnostic and therefore by design could not support overrides. Oh well. Its clearly a test implementation. I agree #2393751: Document that KeyValueEntityStorage is not scalable beyond a few hundred entities would be desirable.
Created a new issue for implementing the stubs at #2406645: Stub methods in KeyValueConfigEntityStorage are not implemented or tested and added @todos in them.
Comment #33
BerdirThat works for me. Setting back to RTBC, we can deal with that storage in those two issues.
@timplunkett in #25: Yes, I was thinking about the paging issue as well, but it doesn't really change anything other than we have to remember to update the subclass, we can still execute the entity query and then load those specific ID's. But it shows that we should move the query in a separate helper method, to make it easier to re-use here. And customize the query.
Comment #34
alexpottThis issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 3bbe561 and pushed to 8.0.x. Thanks!
Comment #36
Gábor HojtsySuperb, thanks!
Comment #37
Gábor HojtsyFound and opened #2407907: Configuration translation entity listings displays items overriden which applies to config translation admin lists for the same entities.
Comment #39
jhodgdonThere is a discussion happening on #2872646: Menu overview always shows the untranslated config entities about this.
Having made this choice, it's really bad-looking if your site has only 1 language that is not English... Let's discuss on that other issue, which has marked this one as Related (since it's the cause of the problem).
Comment #40
Pasqualle#3281219: Language used for config listing should be configurable