ContentReferenceCollection-property that prevents deleting referenced content?

Jouni Huttunen
Member since: 2010
 

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
  • Johan Björnfot
    Member since: 2004
     

    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
  • Jouni Huttunen
    Member since: 2010
     

    Thank you! I will try that one out :)

    #67840 Mar 13, 2013 14:54
  • Jouni Huttunen
    Member since: 2010
     
    #86090 May 13, 2014 18:01
  • Jouni Huttunen
    Member since: 2010
     

    Btw. is this fixed in Episerver 7.5?

    #86091 May 13, 2014 18:02
  • Johan Björnfot
    Member since: 2004
     

    Hi

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

    #86151 May 14, 2014 20:17