Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.
Just want to leave some feedback about possible deprecation of the "entity_upcast" operation. It would make things more consistent for entity view, because of content_translation_language_fallback_candidates_entity_view_alter() that is not applied now to the upcast operation. However, it may cause other troubles, because not all routes display an entity. Some are for editing, deleting an entity or a translation/revision overview and the language fallback logic that is applicable to entity view may not be applicable to these cases. For example, user definitely don't want to delete a fallback translation instead of the actual one. It would be useful to somehow distinguish different types of routes for the language fallback mechanism, e.g. through passing a different operation depending on the type of route.
#15: That is a valid concern. What's interesting is that \Drupal\Core\Entity\EntityRepository::getActiveMultiple() already in HEAD does not use the entity_upcast operation but the default, so the default fallbacks are already applied, so that is pretty much already an issue but I think it doesn't happen that much in practice. You won't see a delete link if a translation doesn't exist and if you can delete a translation you can also view an unpublished translation and a fallback doesn't apply.
> 6: Actually we can do even better, we can get rid of that entirely in [this issue], since apparently no one is using it ;)
According to the comments in #2978048: Unpublished translations should fallback to the original language, this is not correct, and people are in fact relying on it. core doesn't use it, which is IMHO a bug on its own (or it's a bug that entity_upcast ever existed), which is what the referenced issue is about, but now that it does, things are more complicated than that. A classic https://xkcd.com/1172/ ;)
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.
Comments
Comment #2
plachComment #3
berdirI find it interesting that you propose this, since you were kind of against #2978048: Unpublished translations should fallback to the original language, but removing the separate context key will have exactly the same result :)
Comment #4
plachI was against unnecessarily changing that behavior, although I admittedly was not happy about it, now we have a good reason to :)
Comment #5
plach#2942907: Entity system does not provide an API for retrieving an entity variant that is safe for editing was committed.
Comment #7
geek-merlinCan we fold this into #2552663: Consider deprecating language_fallback in favor of entity_language_fallback?
Comment #8
berdirSame as the other issue you commented on, I don't understand how a core issue should be postponed on/duplicated by a contrib module/issue?
Comment #9
geek-merlinAs noted in #2978048: Unpublished translations should fallback to the original language:
Comment #15
dmitriy.trt commentedJust want to leave some feedback about possible deprecation of the "entity_upcast" operation. It would make things more consistent for entity view, because of
content_translation_language_fallback_candidates_entity_view_alter()that is not applied now to the upcast operation. However, it may cause other troubles, because not all routes display an entity. Some are for editing, deleting an entity or a translation/revision overview and the language fallback logic that is applicable to entity view may not be applicable to these cases. For example, user definitely don't want to delete a fallback translation instead of the actual one. It would be useful to somehow distinguish different types of routes for the language fallback mechanism, e.g. through passing a different operation depending on the type of route.Comment #18
andypostComment #20
berdir#15: That is a valid concern. What's interesting is that \Drupal\Core\Entity\EntityRepository::getActiveMultiple() already in HEAD does not use the entity_upcast operation but the default, so the default fallbacks are already applied, so that is pretty much already an issue but I think it doesn't happen that much in practice. You won't see a delete link if a translation doesn't exist and if you can delete a translation you can also view an unpublished translation and a fallback doesn't apply.
Comment #21
andypostComment #22
berdirNote1: I'm currently doing a test implementation of this in #3158130: Many calls to ContextRepository::getAvailableContexts() due to entity upcasting to get rid of that whole context stuff of that API, which I really don't understand why it was added like that and causes major performance issues.
Note2: There is zero issue summary here but this issue was created based on comment #2942907-98: Entity system does not provide an API for retrieving an entity variant that is safe for editing by plach:
> 6: Actually we can do even better, we can get rid of that entirely in [this issue], since apparently no one is using it ;)
According to the comments in #2978048: Unpublished translations should fallback to the original language, this is not correct, and people are in fact relying on it. core doesn't use it, which is IMHO a bug on its own (or it's a bug that entity_upcast ever existed), which is what the referenced issue is about, but now that it does, things are more complicated than that. A classic https://xkcd.com/1172/ ;)