Lovely 12 Hive :)

A couple of hours ago, while surfing the MSDN Forums and I experienced a very interesting Question, well, let’s me share with you here the Question and my answer.

Q : We are creating a custom field type in a multilingual publishing site, we need to use the DisplayPattern to render the field value plus other Data that is language specific? Any ideas ?

A : Again , “The 12 hive is our teacher”.You know the little “New!” Icon that is displayed beside an Item when it’s newly created ?I’ve once created an Arabic/English site and I found out that the image is rendered in Arabic in the Arabic context and in English in the English Context which is great. Then you can definetly do that too either by Code or by CAML.
Let’s see if we can achieve that by means of CAML.
Open the 12 hive, Templates, Featues and open the folder of the fields feature, then open fieldswss.xml.
check the field titled “LinkTitleNoMenu” and let’s have a look at its display pattern.I’ve copied a part of it here, what I care about is the undlerlined part of the CAML below ..

<DisplayPattern>
<IfEqual>
<Expr1><LookupColumn Name=”FSObjType”/></Expr1>
<Expr2>1</Expr2>
<Then><Field Name=”LinkFilenameNoMenu”/></Then>
<Else>
<HTML><![CDATA[<a onfocus=”OnLink(this)” href=”]]></HTML><URL/>
<HTML><![CDATA[” ONCLICK=”GoToLink(this);return false;” target=”_self”>]]>
</HTML>
<Column HTMLEncode=’TRUE’ Name=”Title” Default=’$Resources:core,NoTitle;’>
</Column>
<HTML><![CDATA[</a>]]></HTML>
<IfNew>
<HTML><![CDATA[<IMG SRC=”/_layouts/[%=System.Threading.Thread.CurrentThread.CurrentUICulture.LCID%]/images/new.gif” alt=”]]></HTML>
<HTML>$Resources:core,new_gif_alttext</HTML>
<HTML><![CDATA[“>]]></HTML>
</IfNew>
</Else>
</IfEqual>
</DisplayPattern>

Got it ?You can write server-side code inside your display pattern :0 TERRIFIC
By the way I just discovered that when trying to answer your question but a little humble piece of advice to you is ” Love your 12 hive, Check out the OOB features, 12 Hive can really teach us a lot of cool stuff related to the UX

That was my answer and I’m waiting for him/her to mark it as answered LOL!
see you

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s