I have a Field Provider which maps against a RTE as I'm importing "PAGECONTENT" from the XML file above.
However, I'd like my Field Provider to also include the <LANGUAGE> as well as the <PAGECONTENT> node as I would like to apply some logic based on the language before assigning the value to the RTE within Umbraco.
Yes you can it is supported, if you have definitions created those will be deleted and you need to recreate those ,relation data will be kept in the database so it stills knows which nodes to update etc.
Multiple values in Field Provider
Hi,
I've been through the forum and can't find anything related to this - so apologies if I've missed it and this is a duplicate post!
I'm importing from an XML file which looks like this:
<CONTENT>
<ARTICLE>
<PAGENAME>News Article 1</PAGENAME>
<PAGECONTENT><p>Testing 1</p></PAGECONTENT>
<LANGUAGE>ENGLISH</LANGUAGE>
</ARTICLE>
<ARTICLE>
<PAGENAME>News Article 2</PAGENAME>
<PAGECONTENT><p>Testing 2</p></PAGECONTENT>
<LANGUAGE>SPANISH</LANGUAGE>
</ARTICLE>
</CONTENT>
I have a Field Provider which maps against a RTE as I'm importing "PAGECONTENT" from the XML file above.
However, I'd like my Field Provider to also include the <LANGUAGE> as well as the <PAGECONTENT> node as I would like to apply some logic based on the language before assigning the value to the RTE within Umbraco.
Can anyone help?
Many thanks,
Rick
Hi Rick,
You can solve this in two ways:
Hope this helps.
Best,
Richard
Wow - thank you so much for the quick response Richard!
I'll have a look at the proposed solutions and report back with my impementation for others.
Thanks,
Rick
Thanks Rick! and spread the word about fast support :)
Hi Richard,
I used the RecordImported event in the end like you suggested, I then iterate through my xml file and apply logic based on the language node.
However, in the event signature for RecordImported - the object that comes in is a Document which means I have to then use the obsolete method ...
Document doc = sender as Document;
doc.getProperty("basePageBodyContent").Value = htmlValue;
doc.SaveAndPublish(User.GetUser(0));
... to set the value of the RTE.
Ideally, I'd like to use IContent so that I can use:
IContent doc = (IContent)sender;
doc.SetValue("basePageBodyContent", htmlValue);
Is this possible or am I bound to using Document?
Thank you so much
Rick
Hi Rick,
sorry didn't receive a notification on the comment. In 2.5 it's Document. For V3 this will be Icontent.
Best,
Richard
Hi Richard,
No problem. Is it safe to install and use CMS Import V3 if the package is still in Beta?
Thanks,
Rick
Hi Rick
Yes you can it is supported, if you have definitions created those will be deleted and you need to recreate those ,relation data will be kept in the database so it stills knows which nodes to update etc.
Hope this helps,
Richard
is working on a reply...