Problem/Motivation
Since #2281619: Convert most direct usages within module code of routing related request attributes to use RouteMatchInterface instead and friends usage of the request object to retrieve attributes from it is discouraged in favor of using the RouteMatch
object. Because other subsystems have already performed this switch configuration mappers cannot currently be used there. The route access system is one such subsystem: Custom access checks are passed the route match object if they provide an appropriate type-hint, but they cannot access the correct request object. This was exposed in #2571655: ConfigNamesMapper::hasTranslatable has flawed logic, which is now blocked on this issue. That in turn blocks #2546212: Entity view/form mode formatter/widget settings have no translation UI which is a major bug.
Proposed resolution
- Instead of a
populateFromRequest()
provide apopulateFromRouteMatch()
method - Because we cannot easily set arbitrary data on a
RouteMatch
, add asetLangcode()
method to support the use-case ofConfigTranslationController::itemPage()
Remaining tasks
User interface changes
None.
API changes
ConfigMapperInterface::populateFromRequest()
is removed in favor of::populateFromRouteMatch()
ConfigMapperInterface::setLangcode()
is added
Beta phase evaluation
Issue category | Task (This blocks bugs, so it could be said, this makes it a bug) |
---|---|
Issue priority | Major because this blocks a major bug |
Prioritized changes | Prioritized because this is required to fix a major bug |
Disruption | Disruptive for some modules extending Config Translation's API. The addition of ConfigMapperInterface::setLangcode() is only a break for modules which do not extend ConfigNamesMapper , which should be very, very few in practice. The switch from *Request() to *RouteMatch() is only a break for modules that A) have a dynamic configuration name list, which is not based on configuration entities which is a very far-fetched use-case or for modules or B) manage configuration entities but do not extend ConfigEntityMapper which also should be very, very few in practice. Mappers extending ConfigEntityMapper will override setEntity() instead, so will not notice the change. If this is still considered too disruptive we could leave populateFromRequest() in place and just add populateFromRouteMatch() but due to problem described above, we would be pretending to support an API which we do not actually support in all cases. |
Comment | File | Size | Author |
---|---|---|---|
#16 | convert-2295255-16.patch | 17.82 KB | k4v |
#13 | 2295255-12-config-translation-route-match.patch | 16.61 KB | tstoeckler |
#13 | 2295255-9-12-interdiff.txt | 3.21 KB | tstoeckler |
#2 | 2295255.patch | 1.04 KB | dawehner |
Comments
Comment #1
tim.plunkettComment #2
dawehner.
Comment #4
dawehnerLet's work on it.
Comment #5
dawehnerForget the interdiff
Comment #7
kgoel CreditAttribution: kgoel commentedjust a reroll
Comment #9
dawehnerThis should fix a couple of those problems.
Comment #11
tstoecklerThis is blocking #2546212: Entity view/form mode formatter/widget settings have no translation UI so marking as major bug.
Taking a stab.
Comment #12
tstoecklerRebased and fixed something. Let's see.
Comment #13
tstoeckler#fail
Comment #16
k4v CreditAttribution: k4v as a volunteer commentedComment #17
k4v CreditAttribution: k4v as a volunteer commentedComment #18
tim.plunkettThis is apparently blocking another issue, that should be stated in the IS.
Otherwise, this patch is perfect.
Once the BE and IS are in place, I feel confident in marking this RTBC.
Comment #19
tstoecklerThanks a lot @tim.plunkett !
Comment #20
tstoecklerComment #21
tim.plunkettWonderful. Let's get it in!
Comment #22
Gábor HojtsyAdd blocker since this blocks #2546212: Entity view/form mode formatter/widget settings have no translation UI that is many things don't have a config translation UI due to this.
Comment #23
catchPatch looks great, but isn't this an API change that needs a change record?
Comment #24
tstoecklerAhh sorry about that. Totally forgot. Wrote one now, back to RTBC.
Comment #25
Gábor HojtsyThe change notice makes sense to me. It does not explain the reasons for the change, but it does not need to. Its in the issue summary. This way its concise and easy to follow what is to be changed.
Comment #27
catchCommitted/pushed to 8.0.x, thanks!
Comment #28
Gábor HojtsyYay, moving onto #2571655: ConfigNamesMapper::hasTranslatable has flawed logic now.