The problem is, every time I create a ContentItem i want to also create localized version of it. The localized version should be the same as the original one, with some localizations that I’ll make. So basicaly, whenever i create a ContentItem of the specified type i’ll make a copy of it and do the localization changes, mark the original ContentItem as the localized ContentItem’s LocalizationPart.MasterContentItem and then persist the Item.
Initially i tried to create a copy of the origianl Item when the IContentHandler.Created method is called. The problem is that the Controller hasn’t yet ‘TryUpdate’ the Item, so it lacks data. I doesn’t seem to have access to the controller, in order to try update the Item manually.
I also can’t wait for the Controller to TryUpdate() the ContentItem and then access the already updated Item via some of the other IContentHandler methods, since they are called before that.
Also, persisting the newly created ContentItem is the last possible thing that it is done in the WorkContext, so i can’t query the DB until after the request thread is very much dead.
So, any insights on how to copy a ContentItem that is being created and persist the copy as another item would be great.
I was able to access the updated ContentItem by the IContentHandler.Published method. The inconvenience here is that the method won’t be called until the ContentItem is “Published”. In my scenario though, this isn’t really a problem, since I’ll display either none of them (original ContenItem and localized ContentItem) or both.