Does a Umbraco custom DataEditor know it's pagetype?
Question in the title. I am thinking of the posibility of making a开发者_JAVA技巧 DataEditor for dictionary items hosted on the current template. To make it as easy as possible to translate the page's text.
The easiest way of ascertaining the doc type of the node that your Custom Data Editor is on is to simply look it up using the Document API.
var nodeId = int.Parse(Request["id"]);
var umbracoDocument = new Document(nodeId);
Now you have the Document class you can work out the document type or interact with it in all sorts of ways. For example to get the Document Type alias:
var documentTypeAlias = d.ContentType.Alias;
There are various discussions on this approach and others here:
- http://our.umbraco.org/forum/developers/extending-umbraco/7452-Document-type-alias-in-custom-datatype
- http://forum.umbraco.org/yaf_postst8994_Get-Parent-Nodes-in-Custom-DataType.aspx
精彩评论