Hi, I’m trying to show extra custom data field (a read-only text data for extra custom logging) for a content node on its Umbraco CMS content edit page. But I can’t find a post on similar challenge. Can anyone help?
The old way previously applied are storing it as either “umbraco property of the target content”, OR “child umbraco content under the target”. However, now this extra audit text data need to be separated from umbraco content store due to some limitation.
How can I show this data on the content edit page when this data is stored in other data table? I can make API to further retrieve the data, but no idea on proper way to extend the content edit page.
In the AngularJS controller, for your custom property editor you can get a reference to the current content item's id via
editorState.current.id
(if you inject editorState into your angularJS controller, and also consider to check for null, as new content items won't have a value here until the content item is saved)
You can then use the id, to make a request to your apicontroller that returns the audit data from the custom table
and choose how to display the information in the angularJS view of your custom property editor.
As long as you don't set $scope.model.value - then nothing will be saved for your custom property editor, when the content item is save and published, your editor will just be a read only view of your audit data supplied by your api.
Thanks Marc! That makes sense! Custom Property Editor can read contentId and display content preferred.
Your answer also reminded me about nuPicker. Maybe such goal can be served by nuPicker's "DotNet Labels" in a quicker way. I'll give it a try first.
Show custom data in backend content edit page
Hi, I’m trying to show extra custom data field (a read-only text data for extra custom logging) for a content node on its Umbraco CMS content edit page. But I can’t find a post on similar challenge. Can anyone help?
The old way previously applied are storing it as either “umbraco property of the target content”, OR “child umbraco content under the target”. However, now this extra audit text data need to be separated from umbraco content store due to some limitation.
How can I show this data on the content edit page when this data is stored in other data table? I can make API to further retrieve the data, but no idea on proper way to extend the content edit page.
HI Joe
In V8, 'Content Apps' have been created for just this purpose:
https://our.umbraco.com/documentation/extending/Content-Apps/
But in V7, you can mimic this by creating a custom property editor:
https://our.umbraco.com/Documentation/Tutorials/Creating-a-Property-Editor/index-v7
In the AngularJS controller, for your custom property editor you can get a reference to the current content item's id via
(if you inject editorState into your angularJS controller, and also consider to check for null, as new content items won't have a value here until the content item is saved)
You can then use the id, to make a request to your apicontroller that returns the audit data from the custom table
and choose how to display the information in the angularJS view of your custom property editor.
As long as you don't set $scope.model.value - then nothing will be saved for your custom property editor, when the content item is save and published, your editor will just be a read only view of your audit data supplied by your api.
regards
Marc
Thanks Marc! That makes sense! Custom Property Editor can read contentId and display content preferred. Your answer also reminded me about nuPicker. Maybe such goal can be served by nuPicker's "DotNet Labels" in a quicker way. I'll give it a try first.
Thank you very much!
is working on a reply...