I am using the LinkItemCollection property for my websites menu links, but some of these menu links I would like to hide from the users based on user roles. Unfortunately, it seems that the LinkItemCollection property does not support personalization(like ContentArea does) and I can't just change it to ContentArea property, because there is a lot of content already using this LinkItemCollection.
Is there a way to add personalization feature to this property? Or some kind of workaround?
You could make the content you add to the LinkItemCollection accessible only to users with specific roles?
You can loop through the linkitems in the collection I guess, get the contentdata with 'IContent item = linkItem.GetContentData<IContent>();' and check the access?
Old blog post but worth reading and exploring.
If nothing works then try converting the property to contentarea & write a small rountine to get all the content from linkitemcollection and put it into new contentarea. It should be pretty simple.
Hi. In the link you send, he seems to be using a old episerver version, do you know if his example still works for newer versions?
honestly I don't think you should go that path as approach Anders used is out-dated already to put in that way. I would recommend to to convert to content area (if possible) and personalization there is out-of-the-box.
Hi. I think you are right, I guess I will have to either convert it to a ContentArea or wait on Episever to add this feature to the LinkItemCollection :)