Tracking References
Guide on how to implement tracking entity references for Property Editors in Umbraco
Property editors can be extended further to track entity references that may be selected or referenced inside the property editor. For example in the core of the CMS we have added this to numerous property editors.
A good example of this is the Media Picker. The CMS stores a reference to the selected media item, enabling the identification of content nodes that use that particular media item. This avoids it being accidentally deleted if it is being used.
When a content node is saved it will save the entity references as relations.
Viewing References
For Media Items
Go to the Media section.
Select a media item and click the Info tab.
For Content Nodes
Go to the Settings section.
Under the Relation Types folder, select Related Document relations and click Relations.
For Data Types
Go to the Settings section.
Expand the Data Types folder.
Select the Data Type you wish to view the references
Navigate to the Info tab.
Example
The following example shows how to implement tracking for the inbuilt CMS property editor Content Picker. It will always add a specific media reference, regardless of what value is picked in the content picker. In your own implementations, you will need to parse the value stored from the property editor you are implementing. You will also need to find any references to picked items in order to track their references.
Last updated