ContentReferenceCollection-property that prevents deleting referenced content?

Vote:
 

Hi!

As we all know ContentReference-property will issue a warning if you are about to delete content that's referenced by the property. I want to have the same functionality on a custom property that contains list of ContentReferences,  but I haven't found documentation on how to implement it. The main point is to prevent users from accidentally deleting referenced pages.

Do you have any advices on how to achieve this functionality

#66163
Feb 21, 2013 15:42
Vote:
 

Hi

It is the class ContentSoftLinkIndexer that is responsible for parsing out references from PropertyData instances and store them as SoftLinks (then at e.g. deletion a check is performed if anythings links to an item that is to be deleted and if so a warning is raised).

What you can do is to inherit from the class and override GetLinks method and register your inherited class in the IOC container. In your implementation of GetLinks you would call base.GetLinks to get the system handled properties and then you can add logic for your custom property.

Note:

I have reported a bug that it would be good if the class e.g. exposed an event to make it possible to handle custom properties without having to create a subclass.

#66188
Feb 22, 2013 11:50
Vote:
 

Thank you! I will try that one out :)

#67840
Mar 13, 2013 14:54
Vote:
 
#86090
May 13, 2014 18:01
Vote:
 

Btw. is this fixed in Episerver 7.5?

#86091
May 13, 2014 18:02
Vote:
 

Hi

No it is not fixed in 7.5, it is still in the backlog...

#86151
May 14, 2014 20:17
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.