The change on #4631 made it so data was persisted to the database which is great. Using this, I have a Script that I use in a workflow which
Everything works BUT the DisplayText is not updated as a result. Without setting the "DisplayText", whenever the content is next edited Title will show whatever is in the "DisplayText" and not in the Title part stored in "Content". However, the user on the front end will see rendered out what is in the TitlePart (assuming they get it from "Content" via Liquid). Here is my script that retrieves the content item, updates it, but fails to update the DisplayText:
var parameters = {};
parameters["contentItemId"] = "4ep0v7jh3naxz2s3acps6pq3df";
var contentItems = executeQuery('GetContentItem', parameters);
var contentItem = contentItems[0];
var properties = {
"TitlePart": {
"Title": "I changed the Title"
}
};
updateContentItem(contentItem, properties);
this is very similar to the issue fixed on https://github.com/OrchardCMS/OrchardCore/pull/4908 as the task does not update the ContentItem.Elements property where the parts are stored.
Can you try applying the same fix @jeffolmstead and pr if possible?
Ok we need to re-test this issue but now with other params and make sure everything works. Though TitlePart has been replaced by DisplayText. Need to see if the issue is not because you are assigning the TitlePart only.
If we all agree that TitlePart should be deprecated then the proper fix would be to stop using it and to prevent people from using it.
@Skrypt I didn't know TitlePart had been deprecated / removed. The issue is that "DIsplayText" does not appear in the "Content" (at least that I know of). Only "TitlePart" shows up so that is the only property you are able to update on the merge. Does that make sense? We would need to grant access to editing other fields on the ContentItem instead of just Content if you want the user to be in control.
Yes that makes sense and that's why I said in my PR that the proper fix would be to move DisplayText in the Content so that it updates it with the .Merge or .Apply or else !
I need to first see if this can be done. Else if we can't then try with contentItem.DisplayText
But it's probably not there, just curious.