0

I used droptree field to allow the content author to select news items, and the content author has a specific language for example (en), but I can not filters news by languages. is there any way to return English news (English version) only for English content authors?

enter image description here

1

You need to create Language Based Roles in Role Manager and per item, you need to set the Language Read and Language Write for the particular Role. Follow this link: Language Based Roles

| improve this answer | |
0

One option to do this could be as described here by Ben Golden / Szymon Kuzniak:

https://stackoverflow.com/questions/21452260/sitecore-tree-list-datasource-versionexist

How to filter items by language in Treelist field

Essentially:

  • Create a DataView which will filter out items based on language, override the method to get the correct items and add config to use this.
  • Create a Custom TreeList control which inherits from TreeList and uses the new DataView and register the new control in Sitecore

You would need to update your droptree field to then use this custom Treelist and perhaps add a validator so content editors can only select one item at a time though either using this approach:

http://www.benramey.com/2012/06/12/limit-selected-items-on-sitecore-multilist-field/ (The regex will likely be this though: ^({[^}]+}|?){0,1}$)

or a custom validator similar to these:

https://sitecorecorner.com/2014/08/18/sitecore-custom-field-validator

https://stackoverflow.com/questions/25969604/how-to-validate-a-sitecore-single-line-text-field-to-include-a-character-limit

| improve this answer | |
  • my requirement allows authors to select only one item, therefore I can not use Treelist , is there any way to do the work on droptree or genreal link – Raed Abu Garbeiah Oct 23 '19 at 10:27
  • @RaedAbuGarbeiah you can still use a Treelist, just add an validator to ensure only one item is selected like so: benramey.com/2012/06/12/…. The regex will likely be this though: ^({[^}]+}|?){0,1}$. – Adam Seabridge Oct 23 '19 at 10:32
  • you mean that no way to create single selected like droptree , and should use Treelist – Raed Abu Garbeiah Oct 23 '19 at 10:42

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.