orchardcms - Orchard CMS: How to cancel a remove event -


i have created code disallow deletion of content item if item has localized dependencies. created new "extension" interface , (default)class within orchard.framework.contentmanagement, , created new class within orchard.localization modul, using suppressdependency attribute. returns simple boolean value based on query see if there contentitems list current item mastercontentitem

this called admincontroller within orchard.core.contents, , if returns true add message , redirect returnurl, otherwise removal continues normal.

all of working perfectly.

however, refactor take advantage of existing infrastructure icontentmanager , add removing() method localizationparthandler.

my question - possible "cancel" remove action based on output of contenthandler invoked earlier...

as mentioned in comment i'm not sure want accomplish, guess want create own module , within module create handler implementation in thing...

from understand want hook remove event lifecycle. handlers provide onremoving executes before item removed. i'm not expert on handlers , extension points , how cancel event, guess want implement following:

public class yourcustomhandler : contenthandler {      public yourcustomhandler(iyourcancelservice yourcancelservice) {         onremoving<localizationpart>((context, part) =>              yourcancelservice.cancelremoveevent(context));     } } 

read more info on handlers: http://docs.orchardproject.net/documentation/understanding-content-handlers


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -