Ovee
Ovee

Reputation: 1

Disable editing on text field in Sitecore page editor

I'm using SiteCore 7 MVC and Glassmapper.

I have a set of samples which are rendered using razor and set as standard values when an Author/Editor creates a new page. I wish to prevent the editor from modifying these samples in the PageEditor.

I have used

Model.FullPath.Contains("sample") 

to check if the item being rendered is an item from the sample folder.

This technique works with images using:

@RenderImage(x => x.Image, isEditable:!Model.FullPath.Contains("sample"))

However when I render rich edited text fields (generated by TinyMce) in the following manner:

@(Model.FullPath.Contains("sample") ? 
       Html.Raw(Model.RichTextLeft) : 
       Editable(x => x.RichTextLeft))

The field remains editable even when rendered separately. I have tried using

@Html.Sitecore().Field("SectionTitle")

to render the field (which actually renders nothing).

and

@Html.Raw(Model.RichTextLeft)

to no avail

Any advice would be appreciated.

Upvotes: 0

Views: 1698

Answers (1)

Michael Edwards
Michael Edwards

Reputation: 6518

This issue has been fixed and is available in from the Glass.Mapper build server, this will be in the main release soon.

Upvotes: 0

Related Questions