Problem/Motivation
Comment tokens always consider the original submission language of a comment and do not take the translated value. Additionally to that, the comment body field is optional and may not be present.
Proposed resolution
1. Load the translated comment appropriate for the token's context.
2. Only attempt to use the comment body field if its present.
Remaining tasks
Postponed on #2529182: Not all node, taxonomy entity tokens are multilingual aware
Add tests.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#31 | 1885962-comment-tokens-31.patch | 1.49 KB | TR |
| |||
#22 | 1885962-comment-tokens-22.patch | 1.48 KB | andypost |
Comments
Comment #1
fagoComment #2
YesCT CreditAttribution: YesCT commentedd8mi might want to track this.
Comment #3
fagoComment #4
andypostNo idea what's left here
Comment #5
andypostComment #6
andypost@plach said that the issue need to check that proper translation object is passed to "token replace"
@fago please drop a light
Comment #7
andypostA kind of that used in
node.tokens.inc
Comment #8
andypostComment #9
jibranCan we add some tests for this?
Comment #10
larowlanlooks good but agree on tests
Comment #11
plachCan we get the translation object outside of the switch statement? This way all translatable fields will behave correctly.
Comment #12
YesCT CreditAttribution: YesCT commentedComment #13
andypostSuppose that should be like that?
Comment #14
larowlan>80 and I think a new issue to link to would be great
Comment #15
andypostStill needs tests, filed follow-up #2423341: Rename "body" comment token to "comment_body"
Comment #16
Gábor HojtsyPatch looks good. Still needs tests :)
Comment #17
jibranEntityNG is here now.
Comment #18
penyaskitoNeeds work for the tests.
Comment #19
Gábor HojtsyNobody is working on tests, so removing from the sprint :(
Comment #22
andypostRe-roll patch, working on tests
Comment #23
andypostLooks better to wait for #2529182: Not all node, taxonomy entity tokens are multilingual aware
Because it introduced useful trait for testing tokens and metadata
Comment #24
Gábor HojtsyRemoving from sprint so it reflects what is currently being worked on.
Comment #31
TR CreditAttribution: TR commentedUpdated patch #22 to current HEAD - removed deprecated \Drupal::entityManager()
Still needs tests.
Comment #39
smustgrave CreditAttribution: smustgrave at Mobomo commentedFor the tests.
Comment #40
quietone CreditAttribution: quietone at PreviousNext commentedThis was a bugsmash triage target a few days ago. mstrlen suggested either postponing this on the traits being introduced in #2529182: Not all node, taxonomy entity tokens are multilingual aware or splitting the creation of the traits to a new issue. Since the traits are already in the patch of the other issue I am choosing the first option, postponing.