Closed (fixed)
Project:
Token
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 Oct 2016 at 16:45 UTC
Updated:
26 May 2023 at 20:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
hswong3i commentedComment #3
darrenwh commentedThis line is long and could benefit from having the array's values on separate lines.
Similar comment as above.
Comment #4
chipway commentedThanks hswong3i and darrenwh. Here is a new patch.
Comment #5
darrenwh commentedVery trivial but the speech marks in the translation blocks are not consistent (" or ')?
Comment #6
chipway commentedThanks darrenwh,
Because we have term's with a ' inside the string.
Comment #7
berdirDrupal 8 doesn't have translation sets, it has entity translation.
And config entities don't have entity translations, not like that. Shouldn't be exposed for vocabularies.
This feels like a duplicate of another issue.
Comment #8
gaurav.kapoor commentedMinor fixes.
Comment #9
j-leeThis is out of scope.
+1 for removing the vocabulary part.
Comment #10
j-leeand the new status ...
Comment #11
hswong3i commentedRetouch patch from #8, remove out of scope patch for node-source description, lint with Drupal Coder, via latest 8.x-1.x-dev.
Comment #12
hswong3i commentedUpdate #11 via latest 8.x-1.x-dev
Comment #13
nironan commentedAdds support for term:source tokens to 7.x.
Comment #14
berdirAs pointed out before, this doesn't work and doesn't make sense for vocabulary, that API only does something for content entities. Lets just add this for terms here and if someone needs vocabulary then a separate issue can be opened that loads them as override-free or so.
Comment #15
berdirAlso tests would help to get this committed.
Comment #16
timcosgrove commentedI don't have time to write tests right now, but we want to use this patch, so I rewrote it to remove the vocabulary code and leave terms.
Comment #17
gg4 commentedNoting it still needs tests, but flipping to needs review to make sure existing tests are still green.
Comment #18
gg4 commentedComment #19
ngkoutsaik commentedComment #20
herved commentedThank you for this, we have a need for this in one of our projects.
Adding minimal test.
Comment #21
heddnRe-titleing.
Comment #22
heddnThis has tests, although limited, I'm not sure what more is needed there. And it has manual testing. LGTM.
Comment #23
hswong3i commentedPatch re-roll via 8.x-1.x-dev
Comment #24
markdcI applied #23 to an existing site, cleared cache, added :source to my pathauto term pattern and got the following error on saving a term:
Comment #25
gaurav.kapoor commentedThe patch will require some changes such as adding the use statement for Language Interface.
Comment #26
gaurav.kapoor commentedI noticed, that 8.x-1.x branch of Token module already has the required use statement, but it is missing in 8.x-1.9, so by pushing the patch provided in #23, we can mark this issue as resolved. Adding a patch compatible with 8.x-1.9 in case if someone needs this feature urgently.
Comment #27
james.williamsThis might be scope creep, but could it be implemented dynamically for any content entity type? The \Drupal\Core\Entity\ContentEntityInterface implements \Drupal\Core\TypedData\TranslatableInterface, which contains the getUntranslated() method, which is used for nodes, so I would have thought any content entity could have been done the same way?
Comment #28
gaurav.kapoor commentedComment #29
abu-zakham commentedre-roll patch #26
Comment #31
qusai taha commentedRe-Roll patch #29
Comment #32
dabblela commentedI had some issues with URL generation using term:source:url:path. I think this is because the patches here still pass the original langcode when generating the token. Attached an updated version of #31 that changes this behavior.
Comment #33
rinku jacob 13 commentedI have successfully applied patch #32 drupal version 9.5.x. After applying the patch i can see [term:source] token for Taxonomy terms. Adding Screenshots for the reference
Comment #34
bboty commentedI confirm I have also successfully applied patch #32 Drupal version 9.5.x. After applying the patch i can see [term:source], directly used with [term:source:name] token for Taxonomy terms when generating URL aliases.
Comment #35
bboty commentedComment #37
berdirRe #27: generic entity tokens are tricky, token types have no inheritance, so it needs to altered dynamically, we need to figure out if it's our token or not and then also have generic test coverage.
I'm fine with the test coverage here, committed.