episerverepiserver-6-r2

Is there any way to force "View as Visitor Group" to show in edit mode?


The "View as Visitor Group" option only shows in the EPiServer editor when there is content for visitor groups added to the rich text areas. If you have code based customisations then this makes it hard to preview your changes.

enter image description here

Is it possible to trigger this to show all the time or based on some decision in code?

Currently the workaround is to temporarily add some visitor group content to a text area, save & view, then "View as Visitor Group", then delete the temporary content in the text area before saving which isn't ideal.

This is EPiServer 6R2 (aka 6.1)


Original question: http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=74864 (lifeless forum, ugh). Posted here as I also want to know the answer as I'm working on similar functionality to the original author.


Solution

  • There is an interface IPersonalizedRoles that makes the View as visitor group menu appear if it is implemented on a property. However I think you have to create a custom property to use the interface yourself.

    The SDK for the interface: http://world.episerver.com/Documentation/Class-library/?documentId=cms/7/68f4d6ca-e9a5-884d-4ca8-e5431a345112

    You implement GetRoles() and return an IEnumerable with the visitor group GUID ID:s that you want to show up in the list.

    Maybe you can create a custom dummy property and return your groups there?