9

I got a scenario where i want to add variable in content say multiline text. This variable is kind of link which will be populated based on user profile. Having said that i m looking for best recommended approach so that content author or for that reason any developer in future should not delete or overlooked this variable and publish it without any checks. I may add validation for field and provide help text to deal with this. Is there any better approach to tackle this?

1 Answer 1

4

You can use one of the modules already available for this.

https://jeffdarchuk.com/2015/10/26/sitecore-tokenmanager/

Context from what the link covers:

TokenManager preview

It’s been a while since my last blog post, that’s because I’ve been working hard on a sitecore extension. I’m in the process of working out the last bugs but here’s a preview of what it will be capable of.

Where is it used?

It is found in the Telerik editor from a rich text field.

what is a token?

A token is a small chunk of text that is dynamically replaced with something else when the rich text field is rendered.

Why use tokens?

The most basic of uses is to use tokens to store common information that will change at the same time on every page, such as a customer service phone number, or address. However I’ve devised several more use cases that the TokenManager will be able to accomplish

4
  • @anicho, thanks for this reference. Is there any feature inbuilt wherein content author don't mess with such token and would not allow to publish unless such token is missing. Oct 11, 2016 at 23:26
  • 1
    Tokens are a good choice. I recently build a sitecore pipeline handler that can replace various tokens such as {date:yyyy} with computed values as part of the field render pipeline.
    – zzzzBov
    Oct 12, 2016 at 1:26
  • @SantoshPoojari thank ASURA for the reference. I just updated answer with more context. As for if token is missing I would recommend field validation, a custom validator can make the item unsavable and notifies the user of the problem they need to fix before they can progress.
    – Anicho
    Oct 12, 2016 at 8:34
  • I think it could get a bit messy. I've also done a token pipeline recently and it worked well. The tokens we added only on RTE though with a custom dropdown list. You could add validation for this but I would recommend if you do, you make it easy for the users to find or add the missing tokens. Oct 12, 2016 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.