Adding read-only support for Component Fields was available in Tridion 2009 and in this post I partially bring it back to Tridion 2011 and 2013 using a new GUI Extension. Tridion provides an intuitive and easy to use interface for editing and creating content, technically known as the ComponentView.  Sometimes we have fields that are read-only and receive data from an external system.  For example, the developer might have written a core service application that imports content from an existing product database, for example, and we do not want authors changing that data in Tridion.

This solution extends the Tridion GUI and uses a schema field description naming convention, [readonly] or [hide], to change the behavior of the Tridion ComponentView GUI.  The read-only fields solution was first created by Yoav  Niran a few years ago for Tridion 2009 and is available on his blog here.

In this article I will provide the solution files and instructions for deploying to Tridion 2011 and 2013.

ReadOnlyFields

To enable:

  • Install GUI Extension
  • Update Schema Descriptions and put [readonly] or [hide] in Schema Field Description

Fields currently supported: (only General Content tab)

Not supported:

  • Metadata fields
  • Embedded
  • Date
  • Image

Looking for help with:  (and welcoming community contributions)

  • Find out why GUI Extension does not work when Tridion GUI Minification is enabled
  • Add support for additional field types. I assume I need additional jQuery selectors to get the appropriate div container and then disable it.

Thanks:

I got stuck many times while building this extension and the Tridion Community got me unstuck each time. Special thanks to UI Beardcore, who wrote most of the code that is in this post via this Tridion StackExchange post.

Files for downloading (Gist):

Instructions for deploying:

1. Create a new folder for the GUI Extension on the CMS Server: C:\Program Files (x86)\Tridion\web\WebUI\WebRoot\Editors\Readonly

2. Copy Readonly.config, Readonly.js, and jquery-1.10.0.min.js files to the folder created above.

3.  Disable JavaScript minification in the System.config (‘C:\Program Files (x86)\Tridion\web\WebUI\WebRoot\Configuration\System.config’).  Without this the GUI Extension will not work.
…type=”Tridion.Web.UI.Resources.Filters.JScriptMinifier, Tridion.Web.UI.Resources.Filters” enabled=”never”

  • This is a known issue and I am hoping the community can help me find a solution.

4.  Enable the GUI Extension in the System.config

Add the following to the file ‘C:\Program Files (x86)\Tridion\web\WebUI\WebRoot\Configuration\System.config’

  C:\Program Files (x86)\Tridion\web\WebUI\WebRoot\Editors\Readonly
  Readonly.config

File source code, 3 files:

1.  Readonly.config



2.  Readonly.js


3.  Download the jQuery file

jquery-1.10.0.min.js

Summary

Many things are possible with GUI Extensions and with the right knowledge from the Tridion Community we can achieve a lot. While most of this code is front-end code in the realm of front-end developers, the CMS backend developers are often working directly with Tridion users and thinking how to improve their experience of editing and maintaining content. Collaborating with other front-end developers on these GUI Extensions is the magic that makes these things possible.

Author: Robert Curlette

Robert organizes the Tridion Developer Summit, likes teaching workshops on SDL Tridion, and helps customers implement solutions with SDL Tridion, DD4T, and Alchemy GUI Extensions. If you would like help, please contact me.