Have a look at the source for XPathDropDownList (first line in Save method). It has some code to grab the Property instance that the datatype is being used on, from there I think you could probably get what you want.
I'll have to do some further seraching to get the GUID (or I may switch to this value), but that is a huge help. The below code returns the int for the data type (seen when hovering over the item in the datatype tree)
int umbracoNodeID = ((Widget_Builder_Default_Data)savedData).DataTypeDefinitionId;
Just for completeness for any following readers. This will yield the individual instanceID and GUID if needed for a data type while within a data editor.
There may be a cleaner way, but this certainly gets you there.
int instanceNodeID=((YouDEFAULTdataTYPEclassHERE)savedData).DataTypeDefinitionId;//the int DataTypeDefinition dataTypeDefinition = DataTypeDefinition.GetAll().Where(d => d.DataType.DataTypeDefinitionId == instanceNodeID).First(); Log.Add(LogTypes.Debug, 0, "wbDtD=>" + dataTypeDefinition.UniqueId);//the GUID
Topic author was deleted
How do you get the BaseDataType inside the IDataEditor?
Ok,
This may be hard to explain or maybe I'm just missing something easy.
I'm working on a custom data type. From inside the IDataEditor, I need to know what BaseDataType is for the current instance.
So if I have a DataType called X. I then create two separate instances of X called A and B.
At runtime, I would like to know that I'm inside A or B or whatever the current instance is while inside of the DataEditor.
Ideally I need to know the unique instance ID of A or B.
Please note I'm not asking for the data editor GUID which is the same for A and B.
I'm after the instance GUID of A\B.
Hope that made sense.
Hi Kevin,
Have a look at the source for XPathDropDownList (first line in Save method). It has some code to grab the Property instance that the datatype is being used on, from there I think you could probably get what you want.
-Tom
Comment author was deleted
Thanks for the quick reply. I'm pouring over it now. You just might be 2/2 for me this week ;)
Comment author was deleted
Boom like dynamite, that worked great Tom thx.
I'll have to do some further seraching to get the GUID (or I may switch to this value), but that is a huge help. The below code returns the int for the data type (seen when hovering over the item in the datatype tree)
Comment author was deleted
Just for completeness for any following readers. This will yield the individual instanceID and GUID if needed for a data type while within a data editor.
There may be a cleaner way, but this certainly gets you there.
Comment author was deleted
Oh and the 'savedData' above is your IData interface var.
is working on a reply...