Timeline for Sxa tokens not taken into account in code query
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 8, 2019 at 11:18 | comment | added | Joey Novais | Thanks for the hint ! I am not a dependency injection expert but I finally found how to do it thanks to you. I'll add an answer to explain what I actually did. | |
Mar 8, 2019 at 11:17 | vote | accept | Joey Novais | ||
Mar 8, 2019 at 8:41 | comment | added | Dawid Rutkowski |
Add the following usage: using Microsoft.Extensions.DependencyInjection; . There is almost always a way to get the context item. It is just not obvious in some cases. Check my answer here: sitecore.stackexchange.com/questions/17263/…. If URL contains "hdl" query string than it means that you can get object form session using this "hdl" and inside it you will find context item id.
|
|
Mar 7, 2019 at 15:59 | comment | added | Joey Novais | Hi Dawid, thanks for your response. Unfortunately I can't get the context item since I'm in a Field class which inherit from LinkBase. So the context item is the field itself in the core database. Moreover the method GetService<ITokenResolver>() ask for a type and I don't know which one to give it. | |
Mar 7, 2019 at 13:36 | history | answered | Dawid Rutkowski | CC BY-SA 4.0 |